[PATCH] msvidc32: Make the temporary buffer large enough according to the output depth

André Zwing nerv at dawncrow.de
Mon Jan 10 15:36:44 CST 2022


Signed-off-by: André Zwing <nerv at dawncrow.de>
---
While working on https://bugs.winehq.org/show_bug.cgi?id=52278 I came across those lines and think it's a quite obviously fix
---
 dlls/msvidc32/msvideo1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/msvidc32/msvideo1.c b/dlls/msvidc32/msvideo1.c
index 7b866d04caf..cf45b9f169e 100644
--- a/dlls/msvidc32/msvideo1.c
+++ b/dlls/msvidc32/msvideo1.c
@@ -459,7 +459,7 @@ static LRESULT CRAM_Decompress( Msvideo1Context *info, ICDECOMPRESS *icd, DWORD
 
     if (icd->lpbiOutput->biBitCount != info->depth)
     {
-        output = HeapAlloc(GetProcessHeap(), 0, icd->lpbiOutput->biWidth * icd->lpbiOutput->biHeight * info->depth / 8);
+        output = HeapAlloc(GetProcessHeap(), 0, icd->lpbiOutput->biWidth * icd->lpbiOutput->biHeight * icd->lpbiOutput->biBitCount / 8);
         if (!output) return ICERR_MEMORY;
     }
 
@@ -505,7 +505,7 @@ static LRESULT CRAM_DecompressEx( Msvideo1Context *info, ICDECOMPRESSEX *icd, DW
 
     if (icd->lpbiDst->biBitCount != info->depth)
     {
-        output = HeapAlloc(GetProcessHeap(), 0, icd->lpbiDst->biWidth * icd->lpbiDst->biHeight * info->depth / 8);
+        output = HeapAlloc(GetProcessHeap(), 0, icd->lpbiDst->biWidth * icd->lpbiDst->biHeight * icd->lpbiDst->biBitCount / 8);
         if (!output) return ICERR_MEMORY;
     }
 
-- 
2.25.1




More information about the wine-devel mailing list