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. --- stdlib/strtod_l.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stdlib/strtod_l.c') 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 v1.2.3-65-gdbad