Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at k12text.c:1974

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

K12Text_ensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/k12text.c)expand/collapse
Show more  
 1942  static void K12Text_ensure_buffer_stack (void)
 1943  {
 1944          int num_to_alloc;
 1945       
 1946          if (!(yy_buffer_stack)) {
 1947   
 1948                  /* First allocation is just for 2 elements, since we don't know if this 
 1949                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 1950                   * immediate realloc on the next call.
 1951           */
 1952                  num_to_alloc = 1;
 1953                  (yy_buffer_stack) = (struct yy_buffer_state**)K12Text_alloc
 1954                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 1955                                                                  );
 1956                  if ( ! (yy_buffer_stack) )
 1957                          YY_FATAL_ERROR( "out of dynamic memory in K12Text_ensure_buffer_stack()" );
 1958                                                                     
 1959                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 1960                                   
 1961                  (yy_buffer_stack_max) = num_to_alloc;
 1962                  (yy_buffer_stack_top) = 0;
 1963                  return;
 1964          }
 1965   
 1966          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 1967   
 1968                  /* Increase the buffer to prepare for a possible push. */
 1969                  int grow_size = 8 /* arbitrary grow size */;
 1970   
 1971                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 1972                  (yy_buffer_stack) = (struct yy_buffer_state**)K12Text_realloc
 1973                                                                  ((yy_buffer_stack),
 1974                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 1975[+]                                                                 );
expand/collapse

K12Text_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/k12text.c)expand/collapse
Show more  
 2257  void *K12Text_realloc  (void * ptr, yy_size_t  size )
 2258  {
 2259          /* The cast to (char *) in the following accommodates both 
 2260           * implementations that use char* generic pointers, and those
 2261           * that use void* generic pointers.  It works with the latter
 2262           * because both ANSI C and C++ allow castless assignment from
 2263           * any pointer type to void*, and deal with argument conversions 
 2264           * as though doing an assignment.
 2265           */
 2266          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 1074.30102 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: