From b0debe14fcfe690eee8b5e693554dd258603805d Mon Sep 17 00:00:00 2001 From: Herman ten Brugge Date: Fri, 15 Jun 2018 17:35:17 +0000 Subject: Fix sign of NaN returned by strtod (bug 23007). As reported in bug 23007, strtod ignores any sign in the input string in the case of a NaN result. Thes patch fixes this. Tested for x86_64 (in conjunction with tests to be added separately). [BZ #23007] * stdlib/strtod_l.c (____STRTOF_INTERNAL): Return NaN of appropriate sign. --- ChangeLog | 6 ++++++ stdlib/strtod_l.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6cf157acb3..c0f58f5214 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-06-15 Herman ten Brugge + + [BZ #23007] + * stdlib/strtod_l.c (____STRTOF_INTERNAL): Return NaN of + appropriate sign. + 2018-06-14 Florian Weimer [BZ #23290] diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index a09b093fce..cbff18b49d 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -678,7 +678,7 @@ ____STRTOF_INTERNAL (const STRING_TYPE *nptr, STRING_TYPE **endptr, int group, if (endptr != NULL) *endptr = (STRING_TYPE *) cp; - return retval; + return negative ? -retval : retval; } /* It is really a text we do not recognize. */ -- cgit 1.4.1