cleanup: fix slow opus parsing on bad data

This commit is contained in:
bnnm 2024-07-14 19:45:54 +02:00
parent 25c2375f5d
commit 5f5eacd824

View File

@ -273,7 +273,7 @@ static size_t opus_io_size(STREAMFILE* sf, opus_io_data* data) {
break;
}
if (data_size == 0) {
if (data_size <= 0 || data_size >= 0xFFFFF) { /* arbitrary max + catch -1/EOF */
VGM_LOG("OPUS: data_size is 0 at %x\n", (uint32_t)offset);
return 0; /* bad rip? or could 'break' and truck along */
}