Integer Overflow of Allocation Size at mate_parser.c:1621 |
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/plugins/mate/mate_parser.c)![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1556 | static int yy_get_next_buffer (void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1557 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1558 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1559 | register char *source = (yytext_ptr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1560 | register int number_to_move, i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1561 | int ret_val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1562 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1563 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1564 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1565 | "fatal flex scanner internal error--end of buffer missed" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1566 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1567 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1568 | { /* Don't try to fill the buffer, so this is an EOF. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1569 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1570 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1571 | /* We matched a single character, the EOB, so | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1572 | * treat this as a final EOF. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1573 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1574 | return EOB_ACT_END_OF_FILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1575 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1576 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1577 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1578 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1579 | /* We matched some text prior to the EOB, first | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1580 | * process it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1581 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1582 | return EOB_ACT_LAST_MATCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1583 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1584 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1585 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1586 | /* Try to read more data. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1587 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1588 | /* First move last chars to start of buffer. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1589 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1590 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1591 | for ( i = 0; i < number_to_move; ++i ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1592 | *(dest++) = *(source++); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1593 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1594 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1595 | /* don't do the read, it's not guaranteed to return an EOF, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1596 | * just force an EOF | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1597 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1598 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1599 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1600 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1601 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1602 | int num_to_read = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1603 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1604 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1605 | while ( num_to_read <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1606 | { /* Not enough room in the buffer - grow it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1607 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1608 | /* just a shorter name for the current buffer */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1609 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1610 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1611 | int yy_c_buf_p_offset = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1612 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1613 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1614 | if ( b->yy_is_our_buffer ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1615 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1616 | int new_size = b->yy_buf_size * 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1617 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1618 | if ( new_size <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1619 | b->yy_buf_size += b->yy_buf_size / 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1620 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1621 | b->yy_buf_size *= 2;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1622 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1623 | b->yy_ch_buf = (char *) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1624 | /* Include room in for 2 EOB chars. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1625 | [+] | Materealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1626 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1627 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1628 | /* Can't grow it, we don't own it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1629 | b->yy_ch_buf = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1630 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1631 | if ( ! b->yy_ch_buf ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1632 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1633 | "fatal error - scanner input buffer overflow" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1634 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1635 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1636 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1637 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1638 | number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |