Integer Overflow of Allocation Size at scanner.c:1486 |
No properties have been set. edit properties |
Jump to warning location ↓ | warning details... |
| |
yy_get_next_buffer (/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dfilter/scanner.c)![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1421 | static int yy_get_next_buffer (void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1422 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1423 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1424 | register char *source = (yytext_ptr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1425 | register int number_to_move, i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1426 | int ret_val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1427 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1428 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1429 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1430 | "fatal flex scanner internal error--end of buffer missed" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1431 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1432 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1433 | { /* Don't try to fill the buffer, so this is an EOF. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1434 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1435 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1436 | /* We matched a single character, the EOB, so | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1437 | * treat this as a final EOF. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1438 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1439 | return EOB_ACT_END_OF_FILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1440 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1441 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1442 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1443 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1444 | /* We matched some text prior to the EOB, first | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1445 | * process it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1446 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1447 | return EOB_ACT_LAST_MATCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1448 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1449 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1450 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1451 | /* Try to read more data. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1452 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1453 | /* First move last chars to start of buffer. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1454 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1455 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1456 | for ( i = 0; i < number_to_move; ++i ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1457 | *(dest++) = *(source++); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1458 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1459 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1460 | /* don't do the read, it's not guaranteed to return an EOF, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1461 | * just force an EOF | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1462 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1463 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1464 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1465 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1466 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1467 | int num_to_read = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1468 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1469 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1470 | while ( num_to_read <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1471 | { /* Not enough room in the buffer - grow it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1472 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1473 | /* just a shorter name for the current buffer */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1474 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1475 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1476 | int yy_c_buf_p_offset = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1477 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1478 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1479 | if ( b->yy_is_our_buffer ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1480 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1481 | int new_size = b->yy_buf_size * 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1482 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1483 | if ( new_size <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1484 | b->yy_buf_size += b->yy_buf_size / 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1485 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1486 | b->yy_buf_size *= 2;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1487 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1488 | b->yy_ch_buf = (char *) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1489 | /* Include room in for 2 EOB chars. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1490 | [+] | df_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1491 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1492 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1493 | /* Can't grow it, we don't own it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1494 | b->yy_ch_buf = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1495 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1496 | if ( ! b->yy_ch_buf ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1497 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1498 | "fatal error - scanner input buffer overflow" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1499 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1500 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1501 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1502 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1503 | number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |