Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at ascend-scanner.c:2321

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

ascendensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/ascend-scanner.c)expand/collapse
Show more  
 2289  static void ascendensure_buffer_stack (void)
 2290  {
 2291          int num_to_alloc;
 2292       
 2293          if (!(yy_buffer_stack)) {
 2294   
 2295                  /* First allocation is just for 2 elements, since we don't know if this 
 2296                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 2297                   * immediate realloc on the next call.
 2298           */
 2299                  num_to_alloc = 1;
 2300                  (yy_buffer_stack) = (struct yy_buffer_state**)ascendalloc
 2301                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 2302                                                                  );
 2303                  if ( ! (yy_buffer_stack) )
 2304                          YY_FATAL_ERROR( "out of dynamic memory in ascendensure_buffer_stack()" );
 2305                                                                     
 2306                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 2307                                   
 2308                  (yy_buffer_stack_max) = num_to_alloc;
 2309                  (yy_buffer_stack_top) = 0;
 2310                  return;
 2311          }
 2312   
 2313          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 2314   
 2315                  /* Increase the buffer to prepare for a possible push. */
 2316                  int grow_size = 8 /* arbitrary grow size */;
 2317   
 2318                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 2319                  (yy_buffer_stack) = (struct yy_buffer_state**)ascendrealloc
 2320                                                                  ((yy_buffer_stack),
 2321                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 2322[+]                                                                 );
expand/collapse

ascendrealloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/ascend-scanner.c)expand/collapse
Show more  
 2604  void *ascendrealloc  (void * ptr, yy_size_t  size )
 2605  {
 2606          /* The cast to (char *) in the following accommodates both 
 2607           * implementations that use char* generic pointers, and those
 2608           * that use void* generic pointers.  It works with the latter
 2609           * because both ANSI C and C++ allow castless assignment from
 2610           * any pointer type to void*, and deal with argument conversions 
 2611           * as though doing an assignment.
 2612           */
 2613          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 956.30079 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: