Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at diam_dict.c:2624

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

DiamDictensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/diam_dict.c)expand/collapse
Show more  
 2592  static void DiamDictensure_buffer_stack (void)
 2593  {
 2594          int num_to_alloc;
 2595       
 2596          if (!(yy_buffer_stack)) {
 2597   
 2598                  /* First allocation is just for 2 elements, since we don't know if this 
 2599                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 2600                   * immediate realloc on the next call.
 2601           */
 2602                  num_to_alloc = 1;
 2603                  (yy_buffer_stack) = (struct yy_buffer_state**)DiamDictalloc
 2604                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 2605                                                                  );
 2606                  if ( ! (yy_buffer_stack) )
 2607                          YY_FATAL_ERROR( "out of dynamic memory in DiamDictensure_buffer_stack()" );
 2608                                                                     
 2609                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 2610                                   
 2611                  (yy_buffer_stack_max) = num_to_alloc;
 2612                  (yy_buffer_stack_top) = 0;
 2613                  return;
 2614          }
 2615   
 2616          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 2617   
 2618                  /* Increase the buffer to prepare for a possible push. */
 2619                  int grow_size = 8 /* arbitrary grow size */;
 2620   
 2621                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 2622                  (yy_buffer_stack) = (struct yy_buffer_state**)DiamDictrealloc
 2623                                                                  ((yy_buffer_stack),
 2624                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 2625[+]                                                                 );
expand/collapse

DiamDictrealloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/diam_dict.c)expand/collapse
Show more  
 2952  void *DiamDictrealloc  (void * ptr, yy_size_t  size )
 2953  {
 2954          /* The cast to (char *) in the following accommodates both 
 2955           * implementations that use char* generic pointers, and those
 2956           * that use void* generic pointers.  It works with the latter
 2957           * because both ANSI C and C++ allow castless assignment from
 2958           * any pointer type to void*, and deal with argument conversions 
 2959           * as though doing an assignment.
 2960           */
 2961          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 2289.30081 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: