Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at dtd_preparse.c:1677

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

Dtd_PreParse_ensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_preparse.c)expand/collapse
Show more  
 1645  static void Dtd_PreParse_ensure_buffer_stack (void)
 1646  {
 1647          int num_to_alloc;
 1648       
 1649          if (!(yy_buffer_stack)) {
 1650   
 1651                  /* First allocation is just for 2 elements, since we don't know if this 
 1652                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 1653                   * immediate realloc on the next call.
 1654           */
 1655                  num_to_alloc = 1;
 1656                  (yy_buffer_stack) = (struct yy_buffer_state**)Dtd_PreParse_alloc
 1657                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 1658                                                                  );
 1659                  if ( ! (yy_buffer_stack) )
 1660                          YY_FATAL_ERROR( "out of dynamic memory in Dtd_PreParse_ensure_buffer_stack()" );
 1661                                                                     
 1662                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 1663                                   
 1664                  (yy_buffer_stack_max) = num_to_alloc;
 1665                  (yy_buffer_stack_top) = 0;
 1666                  return;
 1667          }
 1668   
 1669          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 1670   
 1671                  /* Increase the buffer to prepare for a possible push. */
 1672                  int grow_size = 8 /* arbitrary grow size */;
 1673   
 1674                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 1675                  (yy_buffer_stack) = (struct yy_buffer_state**)Dtd_PreParse_realloc
 1676                                                                  ((yy_buffer_stack),
 1677                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 1678[+]                                                                 );
expand/collapse

Dtd_PreParse_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_preparse.c)expand/collapse
Show more  
 1960  void *Dtd_PreParse_realloc  (void * ptr, yy_size_t  size )
 1961  {
 1962          /* The cast to (char *) in the following accommodates both 
 1963           * implementations that use char* generic pointers, and those
 1964           * that use void* generic pointers.  It works with the latter
 1965           * because both ANSI C and C++ allow castless assignment from
 1966           * any pointer type to void*, and deal with argument conversions 
 1967           * as though doing an assignment.
 1968           */
 1969          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 3067.30083 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: