[clang] [clang] Fix null buffer dereference in InitializeFileRemapping (PR #201289)

Krisitan Erik Olsen via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 7 20:38:51 PDT 2026


Kristianerik wrote:

> > Thanks for the guidance. After reviewing CompilerInstanceTest.cpp and tracing all callers of addRemappedFile(StringRef, MemoryBuffer*) across clang/lib/, clang/tools/, and clang-tools-extra/, every call site passes a buffer constructed via getMemBuffer() or getMemBufferCopy() null is impossible by construction. The fuzzer was generating an invalid state that can't occur through any legitimate code path. I'll close this PR.
> 
> If you had time, maybe you could take a look at #201179? This one can be triggered directly on godbolt and I am not sure if it shares the same reason with this one.

Sorry I was a bit busy this weekend, but I took a look at #201179 and it appears to be a different issue. #201188 was a fuzzer-only state that couldn't occur in practice, while #201179 has a real reproducer on godbolt and looks like a regression introduced between clang 20 and 21, possibly related to the ModuleManager in-memory buffer changes in that timeframe. I'll investigate further and follow up on that issue directly.

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


More information about the cfe-commits mailing list