================ @@ -1349,7 +1349,7 @@ void TextDiagnostic::emitSnippetAndCaret( // Prepare source highlighting information for the lines we're about to // emit, starting from the first line. std::unique_ptr<SmallVector<StyleRange>[]> SourceStyles = - highlightLines(BufStart, Lines.first, Lines.second, PP, LangOpts, + highlightLines(BufData, Lines.first, Lines.second, PP, LangOpts, ---------------- bgra8 wrote:
> we have an existing test that embeds a null character into the source and > that doesn't seem to reproduce the issue Can you construct a test case with an embedded null character into the source and make the call to `PP->getCheckPoint(FID, FirstLineStart))` (at `clang/lib/Frontend/TextDiagnostic.cpp:1155` also shown below) return an address _after_ the null? That would reproduce the issue. ``` const char *FirstLineStart = FileData.data() + SM.getDecomposedLoc(SM.translateLineCol(FID, StartLineNumber, 1)).second; if (const char *CheckPoint = PP->getCheckPoint(FID, FirstLineStart)) { assert(CheckPoint >= Buff->getBufferStart() && CheckPoint <= Buff->getBufferEnd()); assert(CheckPoint <= FirstLineStart); size_t Offset = CheckPoint - Buff->getBufferStart(); L.seek(Offset, /*IsAtStartOfLine=*/false); } ``` https://github.com/llvm/llvm-project/pull/80442 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits