[PATCH] xml2: Use MSVC constants for NaN and infinity.
Bernhard Kölbl
besentv at gmail.com
Tue Nov 9 15:05:05 CST 2021
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>
---
I'm not really sure, if this change is really the correct solution to
the attached bug. Something that's still really odd to me, is the huge
amount of thrown exceptions. Also I wasn't able to create any test
code to reproduce this properly. I only had the reported program to
do testing and this change fixed the issue.
---
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;
}
/**
--
2.33.0
More information about the wine-devel
mailing list