(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/index-mail-headers.c) |
| |
| 45 | | | static void (struct index_mail *mail) |
| 46 | | | { |
| 47 | | | struct index_mail_line *lines; |
| 48 | | | const unsigned char *, *data; |
| 49 | | | const uint8_t *match; |
| 50 | | | buffer_t *buf; |
| 51 | | | size_t data_size; |
| 52 | | | unsigned int i, j, count, match_idx, match_count; |
| 53 | | | bool noncontiguous; |
| 54 | | | |
| 55 | | | lines = array_get_modifiable(&mail->, &count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
174 | #define array_get_modifiable(array, count) \ |
175 | ARRAY_TYPE_CAST_MODIFIABLE(array) \ |
176 | array_get_modifiable_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
45 | # define ARRAY_TYPE_CAST_MODIFIABLE(array) \ |
46 | (typeof(*(array)->v_modifiable)) |
| |
|
| 56 | | | |
| 57 | | | |
| 58 | | | |
| 59 | | | qsort(lines, count, sizeof(*lines), ); |
| 60 | | | |
| 61 | | | match = array_get(&mail->, &match_count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
156 | #define array_get(array, count) \ |
157 | ARRAY_TYPE_CAST_CONST(array)array_get_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
43 | # define ARRAY_TYPE_CAST_CONST(array) \ |
44 | (typeof(*(array)->v)) |
| |
|
| 62 | | | = buffer_get_data(mail->, NULL); |
| 63 | | | buf = buffer_create_dynamic(pool_datastack_create(), 256); |
Ignored Return Value
The return value of buffer_create_dynamic() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- The return value of buffer_create_dynamic() is checked 98% of the time in this project. CodeSonar is configured to enforce Ignored Return Value checks for any function whose return value is checked at least 96% of the time, unless the function is used fewer than 20 times. (To modify these thresholds, use configuration file parameters RETURN_CHECKER_SAMPLE_SIZE and RETURN_CHECKER_RATIO. To exempt buffer_create_dynamic() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 64 | | | |
| 65 | | | |
| 66 | | | for (i = match_idx = 0; i < count; i = j) { |
Event 2:
Entering loop body. i < count evaluates to true.
hide
Event 13:
Continuing from loop body. Leaving loop. i < count evaluates to false.
hide
|
|
| 67 | | | |
| 68 | | | |
| 69 | | | while (match_idx < lines[i].field_idx && |
Event 10:
Continuing from loop body. Leaving loop. match_idx < lines[i].field_idx evaluates to false.
hide
|
|
| 70 | | | match_idx < match_count) { |
| 71 | | | if ((mail, match[match_idx]) && |
| 72 | | | mail_cache_field_can_add(mail->trans->cache_trans, |
| 73 | | | mail->data.seq, |
| 74 | | | match_idx)) { |
| 75 | | | |
| 76 | | | i_assert((match[match_idx] &
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
189 | #define i_assert(expr) STMT_START{ \ |
190 | if (unlikely(!(expr))) \ |
191 | i_panic("file %s: line %d (%s): assertion failed: (%s)", \ |
192 | __FILE__, \ |
193 | __LINE__, \ |
194 | __PRETTY_FUNCTION__, \ |
195 | #expr); }STMT_END |
| |
|
| 77 | | | ) == 0); |
Event 5:
Skipping " if". (match[match_idx] & 1) == 0 evaluates to true.
hide
Event 6:
Skipping " if". !((match[match_idx] & 1) == 0) evaluates to false.
hide
Event 7:
Skipping " if". !!((match[match_idx] & 1) == 0) evaluates to true.
hide
Event 8:
Skipping " if". !!!((match[match_idx] & 1) == 0) evaluates to false.
hide
Event 9:
Skipping " if". __builtin_expect(...) evaluates to false.
hide
|
|
| 78 | | | index_mail_cache_add_idx(mail, match_idx, |
| 79 | | | NULL, 0); |
| 80 | | | } |
| 81 | | | match_idx++; |
| 82 | | | } |
| 83 | | | |
| 84 | | | if (match_idx < match_count) { |
Event 11:
Taking true branch. match_idx < match_count evaluates to true.
hide
|
|
| 85 | | | |
| 86 | | | j = i + 1; |
| 87 | | | array_idx_set(&mail->, match_idx, &j);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
184 | #define array_idx_set(array, idx, data) \ |
185 | array_idx_set_i(&(array)->arr + ARRAY_TYPE_CHECK(array, data), \ |
186 | idx, data) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
47 | # define ARRAY_TYPE_CHECK(array, data) \ |
48 | COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE( \ |
49 | **(array)->v_modifiable, *data) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
158 | # define COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(_a, _b) \ |
159 | COMPILE_ERROR_IF_TRUE( \ |
160 | !__builtin_types_compatible_p(typeof(_a), typeof(_b))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
156 | # define COMPILE_ERROR_IF_TRUE(condition) \ |
157 | (sizeof(char[1 - 2 * !!(condition)]) - 1) |
| |
|
| 88 | | | match_idx++; |
| 89 | | | } |
| 90 | | | |
| 91 | | | if (!mail_cache_field_can_add(mail->trans->cache_trans, |
| 92 | | | mail->data.seq, |
| 93 | | | lines[i].field_idx)) { |
Event 12:
Taking true branch. mail_cache_field_can_add(...) evaluates to false.
hide
|
|
| 94 | | | |
| 95 | | | j = i + 1; |
| 96 | | | continue; |
| 97 | | | } |
| 98 | | | |
| 99 | | | |
| 100 | | | |
| 101 | | | buffer_set_used_size(buf, 0); |
| 102 | | | buffer_append(buf, &lines[i].line_num, |
| 103 | | | sizeof(lines[i].line_num)); |
| 104 | | | |
| 105 | | | noncontiguous = FALSE; |
| 106 | | | for (j = i+1; j < count; j++) { |
| 107 | | | if (lines[j].field_idx != lines[i].field_idx) |
| 108 | | | break; |
| 109 | | | |
| 110 | | | if (lines[j].start_pos != lines[j-1].end_pos) |
| 111 | | | noncontiguous = TRUE; |
| 112 | | | buffer_append(buf, &lines[j].line_num, |
| 113 | | | sizeof(lines[j].line_num)); |
| 114 | | | } |
| 115 | | | buffer_append_zero(buf, sizeof(uint32_t)); |
| 116 | | | |
| 117 | | | if (noncontiguous) { |
| 118 | | | for (; i < j; i++) { |
| 119 | | | buffer_append(buf, + lines[i].start_pos, |
| 120 | | | lines[i].end_pos - |
| 121 | | | lines[i].start_pos); |
| 122 | | | } |
| 123 | | | i--; |
| 124 | | | } else { |
| 125 | | | buffer_append(buf, + lines[i].start_pos, |
| 126 | | | lines[j-1].end_pos - lines[i].start_pos); |
| 127 | | | } |
| 128 | | | |
| 129 | | | data = buffer_get_data(buf, &data_size); |
| 130 | | | index_mail_cache_add_idx(mail, lines[i].field_idx, |
| 131 | | | data, data_size); |
| 132 | | | } |
| 133 | | | |
| 134 | | | for (; match_idx < match_count; match_idx++) { |
| 135 | | | if ((mail, match[match_idx]) && |
| 136 | | | mail_cache_field_can_add(mail->trans->cache_trans, |
| 137 | | | mail->data.seq, |
| 138 | | | match_idx)) { |
| 139 | | | |
| 140 | | | i_assert((match[match_idx] &
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
189 | #define i_assert(expr) STMT_START{ \ |
190 | if (unlikely(!(expr))) \ |
191 | i_panic("file %s: line %d (%s): assertion failed: (%s)", \ |
192 | __FILE__, \ |
193 | __LINE__, \ |
194 | __PRETTY_FUNCTION__, \ |
195 | #expr); }STMT_END |
| |
|
| 141 | | | ) == 0); |
| 142 | | | index_mail_cache_add_idx(mail, match_idx, NULL, 0); |
| 143 | | | } |
| 144 | | | } |
| 145 | | | |
| 146 | | | mail->data.dont_cache_field_idx = -1U; |
| 147 | | | } |
| |