Reject wonky FSB MPEG/AT3

This commit is contained in:
bnnm 2025-02-02 12:44:25 +01:00
parent 5870389df5
commit f15bc2dd5a

View File

@ -29,18 +29,20 @@ VGMSTREAM* init_vgmstream_ffmpeg(STREAMFILE* sf) {
/* no checks */
//if (!check_extensions(sf, "..."))
// goto fail;
// return NULL;
/* don't try to open headers and other mini files */
if (get_streamfile_size(sf) <= 0x1000)
goto fail;
return NULL;
// many PSP rips have poorly demuxed videos with a failty RIFF, allow for now
#if 0
/* reject some formats handled elsewhere (better fail and check there than let buggy FFmpeg take over) */
if (check_extensions(sf, "at3"))
goto fail;
#endif
uint32_t id = read_u32be(0x00, sf);
// rejected FSB may play as wonky .mp3
if ((id & 0xFFFFFF00) == get_id32be("FSB\0"))
return NULL;
// typically incorrectly extracted files with padding, best handle in riff.c that reads loops points
if (id == get_id32be("RIFF") && (read_u16le(0x14, sf) == 0x0270 || check_extensions(sf, "at3")))
return NULL;
if (target_subsong == 0) target_subsong = 1;