Reject files with incorrect num_streams

This commit is contained in:
bnnm 2018-08-16 20:05:53 +02:00
parent 8d7fb21c8f
commit 611e556809

View File

@ -503,6 +503,14 @@ static VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile) {
}
#endif
/* files can have thousands subsongs, but let's put a limit */
if (vgmstream->num_streams < 0 || vgmstream->num_streams > 65535) {
VGM_LOG("VGMSTREAM: wrong num_streams (ns=%i)\n", vgmstream->num_streams);
close_vgmstream(vgmstream);
continue;
}
/* save info */
/* stream_index 0 may be used by plugins to signal "vgmstream default" (IOW don't force to 1) */
if (!vgmstream->stream_index)