diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-10 23:22:34 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-10 23:22:34 +0100 |
commit | 2157ebb067bee3cb37c4d9df5a1f3248018f4326 (patch) | |
tree | 6715952bca39edf6a201e94e0444c7460d76f1db /libcpp/charset.cc | |
parent | bcc6fe58251b317127ec9c3291a798da7459d377 (diff) | |
parent | 985d6480fe52a5b109960117ba6a876dd875157e (diff) | |
download | gcc-2157ebb067bee3cb37c4d9df5a1f3248018f4326.zip gcc-2157ebb067bee3cb37c4d9df5a1f3248018f4326.tar.gz gcc-2157ebb067bee3cb37c4d9df5a1f3248018f4326.tar.bz2 |
Merge commit '4f01ae3761ca1f8dd7a33b833ae30624f047ac9c^' into HEAD
Diffstat (limited to 'libcpp/charset.cc')
-rw-r--r-- | libcpp/charset.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libcpp/charset.cc b/libcpp/charset.cc index 5a2229c..e38e0f2 100644 --- a/libcpp/charset.cc +++ b/libcpp/charset.cc @@ -1922,6 +1922,13 @@ cpp_valid_utf8_p (const char *buffer, size_t num_bytes) int err = one_utf8_to_cppchar (&iter, &bytesleft, &cp); if (err) return false; + + /* Additionally, Unicode declares that all codepoints above 0010FFFF are + invalid because they cannot be represented in UTF-16. + + Reject such values.*/ + if (cp >= UCS_LIMIT) + return false; } /* No problems encountered. */ return true; |