]> 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:25:43 +0000 (17:25 +0200)
commit6624318c89185fe8b9d1f61e7a6841a843b8f9f3
treeb7c36e0da59c534b94dac94b3caccc01153f765d
parent63bcc017446d14e64aed8511845400fc661f2828
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