Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at dtd_preparse.c:1227

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

yy_get_next_buffer

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_preparse.c)expand/collapse
Show more  
 1162  static int yy_get_next_buffer (void)
 1163  {
 1164          register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 1165          register char *source = (yytext_ptr);
 1166          register int number_to_move, i;
 1167          int ret_val;
 1168   
 1169          if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 1170                  YY_FATAL_ERROR(
 1171                  "fatal flex scanner internal error--end of buffer missed" );
 1172   
 1173          if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 1174                  { /* Don't try to fill the buffer, so this is an EOF. */
 1175                  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 1176                          {
 1177                          /* We matched a single character, the EOB, so 
 1178                           * treat this as a final EOF.
 1179                           */
 1180                          return EOB_ACT_END_OF_FILE;
 1181                          }
 1182   
 1183                  else 
 1184                          {
 1185                          /* We matched some text prior to the EOB, first 
 1186                           * process it.
 1187                           */
 1188                          return EOB_ACT_LAST_MATCH;
 1189                          }
 1190                  }
 1191   
 1192          /* Try to read more data. */
 1193   
 1194          /* First move last chars to start of buffer. */
 1195          number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 1196   
 1197          for ( i = 0; i < number_to_move; ++i )
 1198                  *(dest++) = *(source++);
 1199   
 1200          if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 1201                  /* don't do the read, it's not guaranteed to return an EOF,
 1202                   * just force an EOF
 1203                   */
 1204                  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 1205   
 1206          else 
 1207                  {
 1208                          int num_to_read =
 1209                          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 1210   
 1211                  while ( num_to_read <= 0 )
 1212                          { /* Not enough room in the buffer - grow it. */
 1213   
 1214                          /* just a shorter name for the current buffer */
 1215                          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 1216   
 1217                          int yy_c_buf_p_offset =
 1218                                  (int) ((yy_c_buf_p) - b->yy_ch_buf);
 1219   
 1220                          if ( b->yy_is_our_buffer )
 1221                                  {
 1222                                  int new_size = b->yy_buf_size * 2;
 1223   
 1224                                  if ( new_size <= 0 )
 1225                                          b->yy_buf_size += b->yy_buf_size / 8;
 1226                                  else 
 1227                                          b->yy_buf_size *= 2;
 1228   
 1229                                  b->yy_ch_buf = (char *)
 1230                                          /* Include room in for 2 EOB chars. */
 1231[+]                                         Dtd_PreParse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
expand/collapse

Dtd_PreParse_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_preparse.c)expand/collapse
Show more  
 1960  void *Dtd_PreParse_realloc  (void * ptr, yy_size_t  size )
 1961  {
 1962          /* The cast to (char *) in the following accommodates both 
 1963           * implementations that use char* generic pointers, and those
 1964           * that use void* generic pointers.  It works with the latter
 1965           * because both ANSI C and C++ allow castless assignment from
 1966           * any pointer type to void*, and deal with argument conversions 
 1967           * as though doing an assignment.
 1968           */
 1969          return (void *) realloc( (char *) ptr, size );
Show more  
 1232                                  }
 1233                          else 
 1234                                  /* Can't grow it, we don't own it. */
 1235                                  b->yy_ch_buf = 0;
 1236   
 1237                          if ( ! b->yy_ch_buf )
 1238                                  YY_FATAL_ERROR(
 1239                                  "fatal error - scanner input buffer overflow" );
 1240   
 1241                          (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
 1242   
 1243                          num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
 1244                                                  number_to_move - 1;
Show more  




Change Warning 3071.30266 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: