Skip to content

Commit 1db606b

Browse files
committed
Before reading the first 4 bytes the function TestMID must check if the buffer is large enough for that.
1 parent 0a6c8bd commit 1db606b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/load_mid.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ BOOL CSoundFile::TestMID(const BYTE *lpStream, DWORD dwMemLength)
751751
mm.mm = (char *)lpStream;
752752
mm.sz = dwMemLength;
753753
h.mmf = &mm;
754+
if (h.mmf->sz < 4) return FALSE;
754755
mmfseek(h.mmf,0,SEEK_SET);
755756
mmreadSBYTES(id, 4, h.mmf);
756757
id[4] = '\0';

0 commit comments

Comments
 (0)