Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at dtd_parse.c:1995

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

Dtd_Parse_ensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_parse.c)expand/collapse
Show more  
 1963  static void Dtd_Parse_ensure_buffer_stack (void)
 1964  {
 1965          int num_to_alloc;
 1966       
 1967          if (!(yy_buffer_stack)) {
 1968   
 1969                  /* First allocation is just for 2 elements, since we don't know if this 
 1970                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 1971                   * immediate realloc on the next call.
 1972           */
 1973                  num_to_alloc = 1;
 1974                  (yy_buffer_stack) = (struct yy_buffer_state**)Dtd_Parse_alloc
 1975                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 1976                                                                  );
 1977                  if ( ! (yy_buffer_stack) )
 1978                          YY_FATAL_ERROR( "out of dynamic memory in Dtd_Parse_ensure_buffer_stack()" );
 1979                                                                     
 1980                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 1981                                   
 1982                  (yy_buffer_stack_max) = num_to_alloc;
 1983                  (yy_buffer_stack_top) = 0;
 1984                  return;
 1985          }
 1986   
 1987          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 1988   
 1989                  /* Increase the buffer to prepare for a possible push. */
 1990                  int grow_size = 8 /* arbitrary grow size */;
 1991   
 1992                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 1993                  (yy_buffer_stack) = (struct yy_buffer_state**)Dtd_Parse_realloc
 1994                                                                  ((yy_buffer_stack),
 1995                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 1996[+]                                                                 );
expand/collapse

Dtd_Parse_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_parse.c)expand/collapse
Show more  
 2278  void *Dtd_Parse_realloc  (void * ptr, yy_size_t  size )
 2279  {
 2280          /* The cast to (char *) in the following accommodates both 
 2281           * implementations that use char* generic pointers, and those
 2282           * that use void* generic pointers.  It works with the latter
 2283           * because both ANSI C and C++ allow castless assignment from
 2284           * any pointer type to void*, and deal with argument conversions 
 2285           * as though doing an assignment.
 2286           */
 2287          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 3078.30082 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: