summaryrefslogtreecommitdiff
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 19:27:11 +0100
commit51a8b1bc81b95c5cda60f8ec37a5adc7a2b2bcf1 (patch)
tree0b879931bbb61eab4893d3178c24fe6d3cb914c9
parent65a21f2b2a306d29b44e70264aca948aa0454219 (diff)
downloadlibexpat-git-resolve-use-of-macros-nan-and-infinity.tar.gz
tests: Resolve use of macros NAN and INFINITY for GNU G++ 4.8.2resolve-use-of-macros-nan-and-infinity
-rw-r--r--expat/Changes5
-rw-r--r--expat/tests/runtests.c20
2 files changed, 22 insertions, 3 deletions
diff --git a/expat/Changes b/expat/Changes
index 40127e1b..1ee670d6 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 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..3ecce3da 100644
--- a/expat/tests/runtests.c
+++ b/expat/tests/runtests.c
@@ -54,7 +54,7 @@
#include <ctype.h>
#include <limits.h>
#include <stdint.h> /* intptr_t uint64_t */
-#include <math.h> /* NAN, INFINITY, isnan */
+#include <math.h> /* isinf, isnan */
#if ! defined(__cplusplus)
# include <stdbool.h>
@@ -11762,6 +11762,20 @@ START_TEST(test_accounting_precision) {
}
END_TEST
+static float
+portableNAN() {
+ const float handmadeNAN = strtof("nan", NULL);
+ assert(isnan(handmadeNAN));
+ return handmadeNAN;
+}
+
+static float
+portableINFINITY() {
+ const float handmadeINFINITY = strtof("infinity", NULL);
+ assert(isinf(handmadeINFINITY));
+ return handmadeINFINITY;
+}
+
START_TEST(test_billion_laughs_attack_protection_api) {
XML_Parser parserWithoutParent = XML_ParserCreate(NULL);
XML_Parser parserWithParent
@@ -11780,7 +11794,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 +11816,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");