Bernhard Kölbl : xml2: Use MSVC constants for NaN and infinity.

Alexandre Julliard julliard at winehq.org
Wed Nov 10 15:34:46 CST 2021


Module: wine
Branch: master
Commit: 8923be8f6871bfd32e42a51eae9932532ee038ef
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8923be8f6871bfd32e42a51eae9932532ee038ef

Author: Bernhard Kölbl <besentv at gmail.com>
Date:   Tue Nov  9 22:05:05 2021 +0100

xml2: Use MSVC constants for NaN and infinity.

Prevent division by zero exceptions from being thrown,
if they are enabled and calls to xmlXPathInit() are being made.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52003
Signed-off-by: Bernhard Kölbl <besentv at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/xml2/xpath.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libs/xml2/xpath.c b/libs/xml2/xpath.c
index 7497ba07d6f..5fa3c72eb6c 100644
--- a/libs/xml2/xpath.c
+++ b/libs/xml2/xpath.c
@@ -497,14 +497,12 @@ double xmlXPathNINF;
  *
  * Initialize the XPath environment
  */
-ATTRIBUTE_NO_SANITIZE("float-divide-by-zero")
 void
 xmlXPathInit(void) {
-    /* MSVC doesn't allow division by zero in constant expressions. */
-    double zero = 0.0;
-    xmlXPathNAN = 0.0 / zero;
-    xmlXPathPINF = 1.0 / zero;
-    xmlXPathNINF = -xmlXPathPINF;
+    /* Use MSVC definitions */
+    xmlXPathNAN = NAN;
+    xmlXPathPINF = INFINITY;
+    xmlXPathNINF = -INFINITY;
 }
 
 /**




More information about the wine-cvs mailing list