Fix infinite loop with bad data in Wwise Vorbis

This commit is contained in:
bnnm 2020-08-22 13:40:49 +02:00
parent e42aebf945
commit ff5ffac950
2 changed files with 5 additions and 2 deletions

View File

@ -59,7 +59,7 @@ static int rv_bits(bitstream_t* ib, uint32_t bits, uint32_t* value) {
return 1;
fail:
VGM_LOG("BITREADER: read fail\n");
VGM_LOG_ONCE("BITREADER: read fail\n");
*value = 0;
return 0;
}
@ -95,7 +95,7 @@ static int wv_bits(bitstream_t* ob, uint32_t bits, uint32_t value) {
ob->b_off += bits;
return 1;
fail:
VGM_LOG("BITREADER: write fail\n");
VGM_LOG_ONCE("BITREADER: write fail\n");
return 0;
}
#endif

View File

@ -160,6 +160,9 @@ static int read_packet(wpacket_t* wp, uint8_t* ibuf, size_t ibufsize, STREAMFILE
break;
}
if (wp->header_size == 0 || wp->packet_size == 0)
goto fail;
/* read packet data */
{
size_t read_size = wp->packet_size;