Bruno Jesus : msadpcm32.acm: Stop converting data instead of crashing.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Oct 1 10:57:01 CDT 2015
Module: wine
Branch: master
Commit: 72528be84fdc0dcfe75e361f4bf7c09fc27b638d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=72528be84fdc0dcfe75e361f4bf7c09fc27b638d
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Tue Sep 29 22:06:21 2015 +0800
msadpcm32.acm: Stop converting data instead of crashing.
Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
dlls/msadp32.acm/msadp32.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/msadp32.acm/msadp32.c b/dlls/msadp32.acm/msadp32.c
index 2c61575..24e0c6a 100644
--- a/dlls/msadp32.acm/msadp32.c
+++ b/dlls/msadp32.acm/msadp32.c
@@ -249,9 +249,17 @@ static void cvtSSms16K(const ACMDRVSTREAMINSTANCE *adsi,
{
const unsigned char* in_src = src;
- assert(*src <= 6);
+ /* Catch a problem from Tomb Raider III (bug 21000) where it passes
+ * invalid data after a valid sequence of blocks */
+ if (*src > 6 || *(src + 1) > 6)
+ {
+ /* Recalculate the amount of used output buffer. We are not changing
+ * nsrc, let's assume the bad data was parsed */
+ *ndst -= nblock * nsamp_blk * adsi->pwfxDst->nBlockAlign;
+ WARN("Invalid ADPCM data, stopping conversion\n");
+ break;
+ }
coeffL = MSADPCM_CoeffSet[*src++];
- assert(*src <= 6);
coeffR = MSADPCM_CoeffSet[*src++];
ideltaL = R16(src); src += 2;
More information about the wine-cvs
mailing list