[MSADP32.ACM] Sync with Wine Staging 1.7.55. CORE-10536
authorAmine Khaldi <amine.khaldi@reactos.org>
Mon, 23 Nov 2015 08:55:46 +0000 (08:55 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Mon, 23 Nov 2015 08:55:46 +0000 (08:55 +0000)
svn path=/trunk/; revision=70045

reactos/dll/win32/msadp32.acm/msadp32.c
reactos/media/doc/README.WINE

index 8b40c83..33707ab 100644 (file)
@@ -251,9 +251,17 @@ static     void cvtSSms16K(const ACMDRVSTREAMINSTANCE *adsi,
     {
         const unsigned char*    in_src = src;
 
     {
         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++];
         coeffL = MSADPCM_CoeffSet[*src++];
-        assert(*src <= 6);
         coeffR = MSADPCM_CoeffSet[*src++];
 
         ideltaL  = R16(src);    src += 2;
         coeffR = MSADPCM_CoeffSet[*src++];
 
         ideltaL  = R16(src);    src += 2;
@@ -544,6 +552,8 @@ static      LRESULT ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
         if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
         break;
     case WAVE_FORMAT_ADPCM:
         if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
         break;
     case WAVE_FORMAT_ADPCM:
+        if (adfs->cbwfxDst < sizeof(ADPCMWAVEFORMAT) + (7 - 1) * sizeof(ADPCMCOEFSET))
+            return ACMERR_NOTPOSSIBLE;
         init_wfx_adpcm((ADPCMWAVEFORMAT*)adfs->pwfxDst);
         /* check if result is ok */
         if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
         init_wfx_adpcm((ADPCMWAVEFORMAT*)adfs->pwfxDst);
         /* check if result is ok */
         if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
index d204ba9..2e0760c 100644 (file)
@@ -105,7 +105,7 @@ reactos/dll/win32/mpr                 # Synced to WineStaging-1.7.55
 reactos/dll/win32/mprapi              # Synced to WineStaging-1.7.47
 reactos/dll/win32/msacm32             # Synced to WineStaging-1.7.55
 reactos/dll/win32/msacm32/msacm32.drv # Synced to WineStaging-1.7.55
 reactos/dll/win32/mprapi              # Synced to WineStaging-1.7.47
 reactos/dll/win32/msacm32             # Synced to WineStaging-1.7.55
 reactos/dll/win32/msacm32/msacm32.drv # Synced to WineStaging-1.7.55
-reactos/dll/win32/msadp32.acm         # Synced to WineStaging-1.7.47
+reactos/dll/win32/msadp32.acm         # Synced to WineStaging-1.7.55
 reactos/dll/win32/mscat32             # Synced to WineStaging-1.7.47
 reactos/dll/win32/mscms               # Synced to WineStaging-1.7.47
 reactos/dll/win32/mscoree             # Synced to Wine-1.5.4
 reactos/dll/win32/mscat32             # Synced to WineStaging-1.7.47
 reactos/dll/win32/mscms               # Synced to WineStaging-1.7.47
 reactos/dll/win32/mscoree             # Synced to Wine-1.5.4