From 51a8b1bc81b95c5cda60f8ec37a5adc7a2b2bcf1 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Wed, 23 Feb 2022 19:17:51 +0100 Subject: tests: Resolve use of macros NAN and INFINITY for GNU G++ 4.8.2 --- expat/Changes | 5 +++++ expat/tests/runtests.c | 20 +++++++++++++++++--- 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 #include #include /* intptr_t uint64_t */ -#include /* NAN, INFINITY, isnan */ +#include /* isinf, isnan */ #if ! defined(__cplusplus) # include @@ -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"); -- cgit v1.2.1