dsound: Fix division by zero in DSOUND_Calc3DBuffer

Maarten Lankhorst m.b.lankhorst at gmail.com
Sun Jul 8 11:04:29 CDT 2007


In case incone != outcone but outcone / 2 == incone/2, a divide by zero
occurs.
-------------- next part --------------
>From 35d761ec89565e55fe5916835c7d85cbc37f7e5f Mon Sep 17 00:00:00 2001
From: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Sun, 8 Jul 2007 16:38:05 +0200
Subject: [PATCH] dsound: Fix division by zero in DSOUND_Calc3DBuffer

---
 dlls/dsound/sound3d.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
index cae1c28..4a26947 100644
--- a/dlls/dsound/sound3d.c
+++ b/dlls/dsound/sound3d.c
@@ -238,6 +238,9 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
 			/* my test show that for my way of calc., we need only half of angles */
 			DWORD dwInsideConeAngle = dsb->ds3db_ds3db.dwInsideConeAngle/2;
 			DWORD dwOutsideConeAngle = dsb->ds3db_ds3db.dwOutsideConeAngle/2;
+			if (dwOutsideConeAngle == dwInsideConeAngle)
+				++dwOutsideConeAngle;
+
 			/* full volume */
 			if (flAngle < dwInsideConeAngle)
 				flAngle = dwInsideConeAngle;
-- 
1.4.4.2



More information about the wine-patches mailing list