]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use unsigned char argument to std::isdigit
authorJonathan Wakely <jwakely@redhat.com>
Wed, 5 May 2021 10:19:55 +0000 (11:19 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 5 May 2021 11:50:45 +0000 (12:50 +0100)
Passing plain char to isdigit is undefined if the value is negative.

libstdc++-v3/ChangeLog:

* include/std/charconv (__from_chars_alnum): Pass unsigned
char to std::isdigit.

libstdc++-v3/include/std/charconv

index 193702e677a6af0c857e79a4a620d01227f4c1c2..571be075a6b35dd73407646945cbdbd875516751 100644 (file)
@@ -565,7 +565,7 @@ namespace __detail
       while (__first != __last)
        {
          unsigned char __c = *__first;
-         if (std::isdigit(__c))
+         if (std::isdigit(static_cast<unsigned char>(__c)))
            __c -= '0';
          else
            {