Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at uat_load.c:1741

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

uat_load_ensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/uat_load.c)expand/collapse
Show more  
 1709  static void uat_load_ensure_buffer_stack (void)
 1710  {
 1711          int num_to_alloc;
 1712       
 1713          if (!(yy_buffer_stack)) {
 1714   
 1715                  /* First allocation is just for 2 elements, since we don't know if this 
 1716                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 1717                   * immediate realloc on the next call.
 1718           */
 1719                  num_to_alloc = 1;
 1720                  (yy_buffer_stack) = (struct yy_buffer_state**)uat_load_alloc
 1721                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 1722                                                                  );
 1723                  if ( ! (yy_buffer_stack) )
 1724                          YY_FATAL_ERROR( "out of dynamic memory in uat_load_ensure_buffer_stack()" );
 1725                                                                     
 1726                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 1727                                   
 1728                  (yy_buffer_stack_max) = num_to_alloc;
 1729                  (yy_buffer_stack_top) = 0;
 1730                  return;
 1731          }
 1732   
 1733          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 1734   
 1735                  /* Increase the buffer to prepare for a possible push. */
 1736                  int grow_size = 8 /* arbitrary grow size */;
 1737   
 1738                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 1739                  (yy_buffer_stack) = (struct yy_buffer_state**)uat_load_realloc
 1740                                                                  ((yy_buffer_stack),
 1741                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 1742[+]                                                                 );
expand/collapse

uat_load_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/uat_load.c)expand/collapse
Show more  
 2024  void *uat_load_realloc  (void * ptr, yy_size_t  size )
 2025  {
 2026          /* The cast to (char *) in the following accommodates both 
 2027           * implementations that use char* generic pointers, and those
 2028           * that use void* generic pointers.  It works with the latter
 2029           * because both ANSI C and C++ allow castless assignment from
 2030           * any pointer type to void*, and deal with argument conversions 
 2031           * as though doing an assignment.
 2032           */
 2033          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 2648.30072 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: