[llvm] [MC] AsmLexer invalid read fix. (PR #154972)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 22:38:42 PDT 2025


================
@@ -0,0 +1,5 @@
+# RUN: llvm-mc -triple=x86_64 --as-lex %s
+
+# This test ensures AsmLexer doesn't perform an invalid read in a case where
+# buffer ends with '\0', ' ' or '\t'
----------------
MaskRay wrote:

A contributor editing the test could easily add the end \n due to editor setting.

```
echo -e 'ret\t' > %t.s
llvm-mc -triple=x86_64 --as-lex %t.s | FileCheck %s
```

and add CHECK for the tokens

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


More information about the llvm-commits mailing list