]> git.ipfire.org Git - thirdparty/glibc.git/commit
Do not set errno for overflowing NaN payload in strtod/nan (bug 32045)
authorJoseph Myers <josmyers@redhat.com>
Wed, 4 Sep 2024 13:21:23 +0000 (13:21 +0000)
committerArjun Shankar <arjun@redhat.com>
Fri, 27 Sep 2024 15:24:43 +0000 (17:24 +0200)
commitc4cc72d2efc741872d65ae1fd77572e47042d179
tree1d1281d2e6a71103f5336954df65859bcab1563c
parentad93c2047d791044d45e8f65070d821b0b918993
Do not set errno for overflowing NaN payload in strtod/nan (bug 32045)

As reported in bug 32045, it's incorrect for strtod/nan functions to
set errno based on overflowing payload (strtod should only set errno
for overflow / underflow of its actual result, and potentially if
nothing in the string can be parsed as a number at all; nan should be
a pure function that never sets it).  Save and restore errno around
the internal strtoull call and add associated test coverage.

Tested for x86_64.

(cherry picked from commit 64f62c47e9c350f353336f2df6714e1d48ec50d8)
math/Makefile
math/test-nan-payload.c
stdlib/strtod_nan_main.c