]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix sign of NaN returned by strtod (bug 23007).
authorHerman ten Brugge <hermantenbrugge@home.nl>
Fri, 15 Jun 2018 17:35:17 +0000 (17:35 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 15 Jun 2018 17:35:17 +0000 (17:35 +0000)
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
stdlib/strtod_l.c

index 6cf157acb36675f14bc3f130f779b5e3905331a4..c0f58f5214c292d5b0c54f72c115e94da34154b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-15  Herman ten Brugge  <hermantenbrugge@home.nl>
+
+       [BZ #23007]
+       * stdlib/strtod_l.c (____STRTOF_INTERNAL): Return NaN of
+       appropriate sign.
+
 2018-06-14  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #23290]
index a09b093fce49da4c083c5f77ba5acd4362d2dd02..cbff18b49d070f97c96e2196989be557d9daefd8 100644 (file)
@@ -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.  */