https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ebc69d089f7cb3168caf4…
commit ebc69d089f7cb3168caf4de80d8f97feca7df37d
Author: Atharva Kulkarni <atharvak1910(a)gmail.com>
AuthorDate: Sat Feb 18 16:03:58 2023 +0530
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Feb 18 19:33:58 2023 +0900
[MCIAVI32] Media Player: Don't open empty files (#5063)
Opening an empty file in media player could cause a crash. CORE-18669
---
dll/win32/mciavi32/mmoutput.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/dll/win32/mciavi32/mmoutput.c b/dll/win32/mciavi32/mmoutput.c
index ee0481c59c7..ca060574e01 100644
--- a/dll/win32/mciavi32/mmoutput.c
+++ b/dll/win32/mciavi32/mmoutput.c
@@ -398,6 +398,13 @@ BOOL MCIAVI_GetInfo(WINE_MCIAVI* wma)
mmioAscend(wma->hFile, &mmckInfo, 0);
}
+
+ /* Empty file */
+ if (alb.numVideoFrames == 0) {
+ WARN("NumVideoFrames: %u, Empty or possibly corrupt video file");
+ return FALSE;
+ }
+
if (alb.numVideoFrames != wma->dwPlayableVideoFrames) {
WARN("AVI header says %d frames, we found %d video frames, reducing playable
frames\n",
wma->dwPlayableVideoFrames, alb.numVideoFrames);
@@ -613,6 +620,11 @@ double MCIAVI_PaintFrame(WINE_MCIAVI* wma, HDC hDC)
if (wma->dwCurrVideoFrame != wma->dwCachedFrame)
{
+ if (wma->dwCurrVideoFrame >= wma->dwPlayableVideoFrames) {
+ ERR("Invalid frame requested. Current : %u Total Playable %u\n",
wma->dwCurrVideoFrame, wma->dwPlayableVideoFrames);
+ return 0;
+ }
+
if (!wma->lpVideoIndex[wma->dwCurrVideoFrame].dwOffset)
return 0;