(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie.c) |
| |
| 367 | | | node_add_child(struct squat_trie *trie, struct squat_node *node, |
| 368 | | | unsigned char chr, int level) |
| 369 | | | { |
| 370 | | | unsigned int old_child_count = node->child_count; |
| 371 | | | struct squat_node *children, *old_children; |
| 372 | | | unsigned char *chars; |
| 373 | | | size_t old_size, new_size; |
| 374 | | | |
| 375 | | | i_assert(node->leaf_string_length == 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 |
| |
|
| 376 | | | |
| 377 | | | if (node->want_sequential) { |
| 378 | | | node_make_squential(trie, node, level); |
| 379 | | | |
| 380 | | | if (chr < SEQUENTIAL_COUNT) |
| 381 | | | return chr; |
| 382 | | | old_child_count = SEQUENTIAL_COUNT; |
| 383 | | | } |
| 384 | | | |
| 385 | | | node->child_count++; |
| 386 | | | new_size = NODE_CHILDREN_ALLOC_SIZE(node->child_count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie-private.h |
| |
100 | #define NODE_CHILDREN_ALLOC_SIZE(child_count) \ |
101 | (MEM_ALIGN(child_count) + \ |
102 | ((child_count) / 8 + 1) * 8 * sizeof(struct squat_node)) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
24 | #define MEM_ALIGN(size) \ |
25 | (((size) + MEM_ALIGN_SIZE-1) & ~((unsigned int) MEM_ALIGN_SIZE-1)) |
| |
|
| 387 | | | |
| 388 | | | if (old_child_count == 0) { |
| 389 | | | |
| 390 | | | node->children.data = i_malloc(new_size); |
| 391 | | | trie->node_alloc_size += new_size; |
| 392 | | | children = NODE_CHILDREN_NODES(node);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie-private.h |
| |
96 | #define NODE_CHILDREN_NODES(_node) \ |
97 | ((struct squat_node *)(NODE_CHILDREN_CHARS(_node) + \ |
98 | MEM_ALIGN((_node)->child_count))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
24 | #define MEM_ALIGN(size) \ |
25 | (((size) + MEM_ALIGN_SIZE-1) & ~((unsigned int) MEM_ALIGN_SIZE-1)) |
| |
|
Unused Value
The value assigned to children is never subsequently used on any execution path. |
|
| 393 | | | } else { |
| 394 | | | old_size = NODE_CHILDREN_ALLOC_SIZE(old_child_count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie-private.h |
| |
100 | #define NODE_CHILDREN_ALLOC_SIZE(child_count) \ |
101 | (MEM_ALIGN(child_count) + \ |
102 | ((child_count) / 8 + 1) * 8 * sizeof(struct squat_node)) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
24 | #define MEM_ALIGN(size) \ |
25 | (((size) + MEM_ALIGN_SIZE-1) & ~((unsigned int) MEM_ALIGN_SIZE-1)) |
| |
|
| 395 | | | if (old_size != new_size) { |
| 396 | | | trie->node_alloc_size += new_size - old_size; |
| 397 | | | node->children.data = i_realloc(node->children.data, |
| 398 | | | old_size, new_size); |
| 399 | | | } |
| 400 | | | |
| 401 | | | children = NODE_CHILDREN_NODES(node);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie-private.h |
| |
96 | #define NODE_CHILDREN_NODES(_node) \ |
97 | ((struct squat_node *)(NODE_CHILDREN_CHARS(_node) + \ |
98 | MEM_ALIGN((_node)->child_count))) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
24 | #define MEM_ALIGN(size) \ |
25 | (((size) + MEM_ALIGN_SIZE-1) & ~((unsigned int) MEM_ALIGN_SIZE-1)) |
| |
|
| 402 | | | old_children = (void *)(NODE_CHILDREN_CHARS(node) + |
| 403 | | | MEM_ALIGN(old_child_count));
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
24 | #define MEM_ALIGN(size) \ |
25 | (((size) + MEM_ALIGN_SIZE-1) & ~((unsigned int) MEM_ALIGN_SIZE-1)) |
| |
|
| 404 | | | if (children != old_children) { |
| 405 | | | memmove(children, old_children, |
| 406 | | | old_child_count * sizeof(struct squat_node)); |
| 407 | | | } |
| 408 | | | } |
| 409 | | | |
| 410 | | | chars = NODE_CHILDREN_CHARS(node); |
| 411 | | | chars[node->child_count - 1] = chr; |
| 412 | | | return node->child_count - 1; |
| 413 | | | } |
| |