Louis Lenders : wined3d: Prevent crash in setup_light.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Feb 11 13:37:08 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 25c885e269645d8ec6f8b5f92a294c6f5f0d4757
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=25c885e269645d8ec6f8b5f92a294c6f5f0d4757

Author: Louis Lenders <xerox_xerox2000 at yahoo.co.uk>
Date:   Sat Feb 11 12:14:19 2006 +0100

wined3d: Prevent crash in setup_light.

---

 dlls/wined3d/device.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a642f79..4b10c6d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -22,6 +22,7 @@
  */
 
 #include "config.h"
+#include <float.h>
 #include "wined3d_private.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@@ -165,7 +166,7 @@ static void setup_light(IWineD3DDevice *
     glLightf(GL_LIGHT0+Index, GL_LINEAR_ATTENUATION,    lightInfo->OriginalParms.Attenuation1);
     checkGLcall("glLightf");
 
-    if ((lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range) != 0) {
+    if ((lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range) >= FLT_MIN) {
         quad_att = 1.4/(lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range);
     } else {
         quad_att = 0; /*  0 or  MAX?  (0 seems to be ok) */




More information about the wine-cvs mailing list