[llvm] [MC] AsmLexer assert buffer is null-terminated at CurBuf.end() (PR #154972)
Szymon Piotr Milczek via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 20 05:12:33 PDT 2025
================
@@ -120,6 +120,11 @@ AsmLexer::AsmLexer(const MCAsmInfo &MAI) : MAI(MAI) {
void AsmLexer::setBuffer(StringRef Buf, const char *ptr,
bool EndStatementAtEOF) {
+ // Null terminator must be part of the actual buffer. It must reside at
+ // `Buf.end()`. It must be safe to dereference `Buf.end()`.
+ assert(*Buf.end() == '\0' &&
----------------
smilczek wrote:
Comments added in 8a0b79b5cf00613b31f8e1de7a95549556a55a9b
https://github.com/llvm/llvm-project/pull/154972
More information about the llvm-commits
mailing list