From 240d7ae8ff559e978b9fb3f111877b9e690794ac Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Tue, 29 Oct 2013 11:09:51 -0700 Subject: [PATCH] Fixed playptmod checking for ADPCM samples --- Frameworks/playptmod/playptmod/playptmod.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Frameworks/playptmod/playptmod/playptmod.c b/Frameworks/playptmod/playptmod/playptmod.c index 8eca66850..e17c5248a 100644 --- a/Frameworks/playptmod/playptmod/playptmod.c +++ b/Frameworks/playptmod/playptmod/playptmod.c @@ -1333,12 +1333,13 @@ int playptmod_LoadMem(void *_p, const unsigned char *buf, unsigned long bufLengt s->offset = sampleOffset; j = (s->length + 1) / 2 + 5 + 16; + if ( j > s->length ) j = s->length; bufread(tempSample, 1, j, fmodule); smpDat8 = tempSample; - if (s->length > 5 && memcmp(smpDat8, "ADPCM", 5) == 0) + if (j > 5 + 16 && memcmp(smpDat8, "ADPCM", 5) == 0) { s->reallength = j; }