Added ddraw-Prevent_viewport_crash patchset

This commit is contained in:
Alistair Leslie-Hughes 2018-07-11 10:57:01 +10:00
parent 7993325086
commit 292a0e67f4
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From 1cee10b74621b8d70ff31b6e358ee52bd57e695e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B3zef=20Kucia?= <jkucia@codeweavers.com>
Date: Sat, 2 Jan 2016 11:48:45 +0100
Subject: [PATCH] ddraw: Prevent division by zero in viewport_activate.
Reply-To: wine-devel <wine-devel@winehq.org>
This just stop the crash, without fixing the actual cause.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36763
---
dlls/ddraw/viewport.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c
index 5ebc41e..16cdad4 100644
--- a/dlls/ddraw/viewport.c
+++ b/dlls/ddraw/viewport.c
@@ -71,6 +71,10 @@ void viewport_activate(struct d3d_viewport *This, BOOL ignore_lights)
/* And copy the values in the structure used by the device */
if (This->use_vp2)
{
+ if (!This->viewports.vp2.dvMinZ && !This->viewports.vp2.dvMaxZ
+ && !This->viewports.vp2.dvClipWidth && !This->viewports.vp2.dvClipHeight)
+ return;
+
vp.dwX = This->viewports.vp2.dwX;
vp.dwY = This->viewports.vp2.dwY;
vp.dwHeight = This->viewports.vp2.dwHeight;
--
2.4.10

View File

@ -0,0 +1 @@
Fixes: [36763] Prevent division by zero in viewport_activate

View File

@ -135,6 +135,7 @@ patch_enable_all ()
enable_ddraw_Fix_Typos="$1"
enable_ddraw_FlipToGDISurface="$1"
enable_ddraw_IDirect3DTexture2_Load="$1"
enable_ddraw_Prevent_viewport_crash="$1"
enable_ddraw_Rendering_Targets="$1"
enable_ddraw_Silence_FIXMEs="$1"
enable_ddraw_Write_Vtable="$1"
@ -580,6 +581,9 @@ patch_enable ()
ddraw-IDirect3DTexture2_Load)
enable_ddraw_IDirect3DTexture2_Load="$2"
;;
ddraw-Prevent_viewport_crash)
enable_ddraw_Prevent_viewport_crash="$2"
;;
ddraw-Rendering_Targets)
enable_ddraw_Rendering_Targets="$2"
;;
@ -3500,6 +3504,21 @@ if test "$enable_ddraw_IDirect3DTexture2_Load" -eq 1; then
) >> "$patchlist"
fi
# Patchset ddraw-Prevent_viewport_crash
# |
# | This patchset fixes the following Wine bugs:
# | * [#36763] Prevent division by zero in viewport_activate
# |
# | Modified files:
# | * dlls/ddraw/viewport.c
# |
if test "$enable_ddraw_Prevent_viewport_crash" -eq 1; then
patch_apply ddraw-Prevent_viewport_crash/0001-ddraw-Prevent-division-by-zero-in-viewport_acti.patch
(
printf '%s\n' '+ { "Józef Kucia", "ddraw: Prevent division by zero in viewport_activate.", 1 },';
) >> "$patchlist"
fi
# Patchset ddraw-Rendering_Targets
# |
# | This patchset fixes the following Wine bugs: