]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libcpp: allow UCS_LIMIT codepoints in UTF-8 strings
authorBen Boeckel <me@benboeckel.net>
Wed, 21 Jun 2023 18:58:20 +0000 (14:58 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 23 Jun 2023 20:04:12 +0000 (16:04 -0400)
Fixes r14-1954 (libcpp: reject codepoints above 0x10FFFF, 2023-06-06)

libcpp/

* charset.cc: Allow `UCS_LIMIT` in UTF-8 strings.

Reported-by: Damien Guibouret <damien.guibouret@partition-saving.com>
Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
libcpp/charset.cc

index d492f66adbc93c0ec7ff5aaff15cc5ed98c48a8f..7b625c9956a62d82efb44ecf870c5bc90f55cebb 100644 (file)
@@ -1891,7 +1891,7 @@ cpp_valid_utf8_p (const char *buffer, size_t num_bytes)
         invalid because they cannot be represented in UTF-16.
 
         Reject such values.*/
-      if (cp >= UCS_LIMIT)
+      if (cp > UCS_LIMIT)
        return false;
     }
   /* No problems encountered.  */