Brandon Moore : msadpm: Stop decoding instead of crashing for invalid adpcm data.

Alexandre Julliard julliard at winehq.org
Mon May 23 15:51:52 CDT 2022


Module: wine
Branch: master
Commit: 63f9a08240a076c1382fc8298a7236a0d7134a78
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=63f9a08240a076c1382fc8298a7236a0d7134a78

Author: Brandon Moore <moore.3071 at osu.edu>
Date:   Fri Apr 29 16:50:55 2022 -0700

msadpm: Stop decoding instead of crashing for invalid adpcm data.

Apply the same patch from 72528be84fdc for adpcm data sent to mono
destinations in addition to stereo destinations.

Signed-off-by: Brandon Moore <moore.3071 at osu.edu>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msadp32.acm/msadp32.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/msadp32.acm/msadp32.c b/dlls/msadp32.acm/msadp32.c
index 2dc11b9239a..b31f6371a7a 100644
--- a/dlls/msadp32.acm/msadp32.c
+++ b/dlls/msadp32.acm/msadp32.c
@@ -319,7 +319,14 @@ static	void cvtMMms16K(const ACMDRVSTREAMINSTANCE *adsi,
     {
         const unsigned char*    in_src = src;
 
-        assert(*src <= 6);
+        /* Catch a problem from Lord of the Rings War of the Ring where it
+         * passes invalid data. */
+        if (*src > 6)
+        {
+                *ndst -= nblock * nsamp_blk * adsi->pwfxDst->nBlockAlign;
+                WARN("Invalid ADPCM data, stopping conversion\n");
+                break;
+        }
         coeff = MSADPCM_CoeffSet[*src++];
 
         idelta =  R16(src);     src += 2;




More information about the wine-cvs mailing list