Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at squat-trie.c:411

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

node_read_children

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie.c)expand/collapse
Show more  
 430  node_read_children(struct squat_trie *trie, struct squat_node *node, int level)
 431  {
 432          const uint8_t *data, *end;
 433          const unsigned char *child_chars;
 434          struct squat_node *child, *children = NULL;
 435          uoff_t node_offset;
 436          unsigned int i, child_idx, child_count;
 437          uoff_t base_offset;
 438          uint32_t num;
 439   
 440          i_assert(node->children_not_mapped);
 441          i_assert(!node->have_sequential);
 442          i_assert(trie->unmapped_child_count > 0);
 443          i_assert(trie->data_size <= trie->locked_file_size);
 444   
 445          trie->unmapped_child_count--;
 446          node_offset = node->children.offset;
 447          node->children_not_mapped = FALSE;
 448          node->children.data = NULL;
 449   
 450[+]         if (trie_file_cache_read(trie, node_offset, TRIE_READAHEAD_SIZE) < 0)
 451                  return -1;
 452          if (unlikely(node_offset >= trie->data_size)) {
 453                  squat_trie_set_corrupted(trie);
 454                  return -1;
 455          }
 456   
 457          data = CONST_PTR_OFFSET(trie->data, node_offset);
 458          end = CONST_PTR_OFFSET(trie->data, trie->data_size);
 459          child_count = *data++;
 460          if (unlikely(node_offset + child_count >= trie->data_size)) {
 461                  squat_trie_set_corrupted(trie);
 462                  return -1;
 463          }
 464   
 465          if (child_count == 0)
 466                  return 0;
 467   
 468          child_chars = data;
 469          data += child_count;
 470   
 471          /* get child offsets */
 472          base_offset = node_offset;
 473          for (i = 0; i < child_count; i++) {
 474                  /* we always start with !have_sequential, so at i=0 this 
 475                     check always goes to add the first child */
 476                  if (node->have_sequential && child_chars[i] < SEQUENTIAL_COUNT)
 477                          child_idx = child_chars[i];
 478                  else {
 479                          child_idx = node_add_child(trie, node, child_chars[i],
 480[+]                                                    level);
expand/collapse

node_add_child

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie.c)expand/collapse
Show more  
 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);
 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);
 387   
 388          if (old_child_count == 0) {
 389                  /* first child */
 390                  node->children.data = i_malloc(new_size);
 391                  trie->node_alloc_size += new_size;
 392                  children = NODE_CHILDREN_NODES(node);
 393          } else {
 394                  old_size = NODE_CHILDREN_ALLOC_SIZE(old_child_count);
 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);
 402                  old_children = (void *)(NODE_CHILDREN_CHARS(node) +
 403                                          MEM_ALIGN(old_child_count));
 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;
Show more  
Show more  




Change Warning 8085.24573 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: