[clang-tools-extra] [clang-tidy] Fix OOB access in `FormatStringConverter` with signed chars (PR #169215)

via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 23 07:38:31 PST 2025


================
@@ -54,6 +54,13 @@ void printf_deceptive_newline() {
   // CHECK-FIXES: std::println("Hello");
 }
 
+void printf_utf8_text() {
+  // Hex encodes U+4F60 U+597D U+4E16 U+754C (你好世界) in UTF-8
+  printf("\xE4\xBD\xA0\xE5\xA5\xBD\xE4\xB8\x96\xE7\x95\x8C\n");
----------------
zeyi2 wrote:

Can be verified using: `python3 -c 'print(b"\xE4\xBD\xA0\xE5\xA5\xBD\xE4\xB8\x96\xE7\x95\x8C\n".decode("utf-8"), end="")'`

https://github.com/llvm/llvm-project/pull/169215


More information about the cfe-commits mailing list