Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at scanner.c:1936

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

df_ensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dfilter/scanner.c)expand/collapse
Show more  
 1904  static void df_ensure_buffer_stack (void)
 1905  {
 1906          int num_to_alloc;
 1907       
 1908          if (!(yy_buffer_stack)) {
 1909   
 1910                  /* First allocation is just for 2 elements, since we don't know if this 
 1911                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 1912                   * immediate realloc on the next call.
 1913           */
 1914                  num_to_alloc = 1;
 1915                  (yy_buffer_stack) = (struct yy_buffer_state**)df_alloc
 1916                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 1917                                                                  );
 1918                  if ( ! (yy_buffer_stack) )
 1919                          YY_FATAL_ERROR( "out of dynamic memory in df_ensure_buffer_stack()" );
 1920                                                                     
 1921                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 1922                                   
 1923                  (yy_buffer_stack_max) = num_to_alloc;
 1924                  (yy_buffer_stack_top) = 0;
 1925                  return;
 1926          }
 1927   
 1928          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 1929   
 1930                  /* Increase the buffer to prepare for a possible push. */
 1931                  int grow_size = 8 /* arbitrary grow size */;
 1932   
 1933                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 1934                  (yy_buffer_stack) = (struct yy_buffer_state**)df_realloc
 1935                                                                  ((yy_buffer_stack),
 1936                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 1937[+]                                                                 );
expand/collapse

df_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dfilter/scanner.c)expand/collapse
Show more  
 2219  void *df_realloc  (void * ptr, yy_size_t  size )
 2220  {
 2221          /* The cast to (char *) in the following accommodates both 
 2222           * implementations that use char* generic pointers, and those
 2223           * that use void* generic pointers.  It works with the latter
 2224           * because both ANSI C and C++ allow castless assignment from
 2225           * any pointer type to void*, and deal with argument conversions 
 2226           * as though doing an assignment.
 2227           */
 2228          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 1128.30068 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: