(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/index-sort-string.c) |
| |
| 162 | | | static void index_sort_node_add(struct sort_string_context *ctx, |
| 163 | | | struct mail_sort_node *node) |
| 164 | | | { |
| 165 | | | struct index_transaction_context *t = |
| 166 | | | (struct index_transaction_context *)ctx->program->t; |
| 167 | | | struct mail_index_map *map; |
| 168 | | | const void *data; |
| 169 | | | uint32_t reset_id; |
| 170 | | | bool expunged; |
| 171 | | | |
| 172 | | | mail_index_lookup_ext_full(t->trans_view, node->seq, |
| 173 | | | ctx->ext_id, &map, &data, &expunged); |
| 174 | | | if (expunged) { |
| 175 | | | |
| 176 | | | node->no_update = TRUE; |
| 177 | | | |
| 178 | | | |
| 179 | | | |
| 180 | | | |
| 181 | | | |
| 182 | | | |
| 183 | | | node->sort_id = 0; |
| 184 | | | } else { |
| 185 | | | node->sort_id = data == NULL ? 0 : *(const uint32_t *)data; |
| 186 | | | if (node->sort_id == 0) { |
| 187 | | | if (ctx->lowest_nonexpunged_zero > node->seq || |
| 188 | | | ctx->lowest_nonexpunged_zero == 0) |
| 189 | | | ctx->lowest_nonexpunged_zero = node->seq; |
| 190 | | | } else { |
| 191 | | | i_assert(ctx->lowest_nonexpunged_zero == 0 ||
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 |
| |
|
| 192 | | | ctx->lowest_nonexpunged_zero > node->seq); |
| 193 | | | } |
| 194 | | | } |
| 195 | | | |
| 196 | | | if (node->sort_id != 0) { |
| 197 | | | |
| 198 | | | |
| 199 | | | if (!mail_index_ext_get_reset_id(t->trans_view, map, |
| 200 | | | ctx->ext_id, &reset_id)) |
| 201 | | | reset_id = 0; |
| 202 | | | if (reset_id != ctx->highest_reset_id) { |
| 203 | | | if (reset_id < ctx->highest_reset_id) { |
| 204 | | | i_assert(expunged);
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 |
| |
|
| 205 | | | node->sort_id = 0; |
Unreachable Computation
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 206 | | | } else if (ctx->have_all_wanted) { |
| 207 | | | |
| 208 | | | |
| 209 | | | |
| 210 | | | node->sort_id = 0; |
| 211 | | | ctx->no_writing = TRUE; |
| 212 | | | } else { |
| 213 | | | ctx->highest_reset_id = reset_id; |
| 214 | | | index_sort_reget_sort_ids(ctx); |
| 215 | | | } |
| 216 | | | } |
| 217 | | | } |
| 218 | | | |
| 219 | | | if (node->sort_id == 0) |
| 220 | | | array_append(&ctx->zero_nodes, node, 1);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
116 | #define array_append(array, data, count) \ |
117 | array_append_i(&(array)->arr + ARRAY_TYPE_CHECK(array, data), \ |
118 | data, count) |
| |
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) |
| |
|
| 221 | | | else |
| 222 | | | array_append(&ctx->nonzero_nodes, node, 1);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
116 | #define array_append(array, data, count) \ |
117 | array_append_i(&(array)->arr + ARRAY_TYPE_CHECK(array, data), \ |
118 | data, count) |
| |
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) |
| |
|
| 223 | | | if (ctx->last_seq < node->seq) |
| 224 | | | ctx->last_seq = node->seq; |
| 225 | | | } |
| |