summaryrefslogtreecommitdiff
path: root/expat
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2022-02-23 19:17:51 +0100
committerSebastian Pipping <sebastian@pipping.org>2022-02-23 22:58:36 +0100
commitf6f5d9bb4cc05fb9544ec92e0c3e6a44013cbc1f (patch)
treebd602dfc6a1e0fbd32df3abfd9a886b03473ff1b /expat
parent65a21f2b2a306d29b44e70264aca948aa0454219 (diff)
downloadlibexpat-git-f6f5d9bb4cc05fb9544ec92e0c3e6a44013cbc1f.tar.gz
tests: Resolve use of macros NAN and INFINITY for GNU G++ 4.8.2
Diffstat (limited to 'expat')
-rw-r--r--expat/Changes5
-rw-r--r--expat/tests/runtests.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/expat/Changes b/expat/Changes
index 40127e1b..f5b0363a 100644
--- a/expat/Changes
+++ b/expat/Changes
@@ -2,6 +2,11 @@ NOTE: We are looking for help with a few things:
https://github.com/libexpat/libexpat/labels/help%20wanted
If you can help, please get in touch. Thanks!
+Release x.x.x xxx xxxxxxxx xx xxxx
+ Other changes:
+ #569 #571 tests: Resolve use of macros NAN and INFINITY for GNU G++
+ 4.8.2 on Solaris.
+
Release 2.4.6 Sun February 20 2022
Bug fixes:
#566 Fix a regression introduced by the fix for CVE-2022-25313
diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c
index 6d6f6690..60da868e 100644
--- a/expat/tests/runtests.c
+++ b/expat/tests/runtests.c
@@ -54,7 +54,6 @@
#include <ctype.h>
#include <limits.h>
#include <stdint.h> /* intptr_t uint64_t */
-#include <math.h> /* NAN, INFINITY, isnan */
#if ! defined(__cplusplus)
# include <stdbool.h>
@@ -11762,6 +11761,16 @@ START_TEST(test_accounting_precision) {
}
END_TEST
+static float
+portableNAN() {
+ return strtof("nan", NULL);
+}
+
+static float
+portableINFINITY() {
+ return strtof("infinity", NULL);
+}
+
START_TEST(test_billion_laughs_attack_protection_api) {
XML_Parser parserWithoutParent = XML_ParserCreate(NULL);
XML_Parser parserWithParent
@@ -11780,7 +11789,7 @@ START_TEST(test_billion_laughs_attack_protection_api) {
== XML_TRUE)
fail("Call with non-root parser is NOT supposed to succeed");
if (XML_SetBillionLaughsAttackProtectionMaximumAmplification(
- parserWithoutParent, NAN)
+ parserWithoutParent, portableNAN())
== XML_TRUE)
fail("Call with NaN limit is NOT supposed to succeed");
if (XML_SetBillionLaughsAttackProtectionMaximumAmplification(
@@ -11802,7 +11811,7 @@ START_TEST(test_billion_laughs_attack_protection_api) {
== XML_FALSE)
fail("Call with positive limit >=1.0 is supposed to succeed");
if (XML_SetBillionLaughsAttackProtectionMaximumAmplification(
- parserWithoutParent, INFINITY)
+ parserWithoutParent, portableINFINITY())
== XML_FALSE)
fail("Call with positive limit >=1.0 is supposed to succeed");