diff mbox series

[1/1] libcpp: allow UCS_LIMIT codepoints in UTF-8 strings

Message ID 20230621185820.1766291-1-ben.boeckel@kitware.com
State New
Headers show
Series [1/1] libcpp: allow UCS_LIMIT codepoints in UTF-8 strings | expand

Commit Message

Ben Boeckel June 21, 2023, 6:58 p.m. UTC
libcpp/

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

Reported-by: Damien Guibouret <damien.guibouret@partition-saving.com>
Fixes: c1dbaa6656a (libcpp: reject codepoints above 0x10FFFF, 2023-06-06)
Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
---
 libcpp/charset.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Merrill June 23, 2023, 8:05 p.m. UTC | #1
On 6/21/23 14:58, Ben Boeckel wrote:
> libcpp/
> 
> 	* charset.cc: Allow `UCS_LIMIT` in UTF-8 strings.
> 
> Reported-by: Damien Guibouret <damien.guibouret@partition-saving.com>
> Fixes: c1dbaa6656a (libcpp: reject codepoints above 0x10FFFF, 2023-06-06)
> Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>

Applied, moving the Fixes line up and changing the commit ID to the git 
gcc-descr version.  Thanks.

> ---
>   libcpp/charset.cc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libcpp/charset.cc b/libcpp/charset.cc
> index d4f573e365f..54ebab2b8a4 100644
> --- a/libcpp/charset.cc
> +++ b/libcpp/charset.cc
> @@ -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.  */
diff mbox series

Patch

diff --git a/libcpp/charset.cc b/libcpp/charset.cc
index d4f573e365f..54ebab2b8a4 100644
--- a/libcpp/charset.cc
+++ b/libcpp/charset.cc
@@ -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.  */