Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/lib/Lex/HeaderMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ std::optional<StringRef> HeaderMapImpl::getString(unsigned StrTabIdx) const {
unsigned MaxLen = FileBuffer->getBufferSize() - StrTabIdx;
unsigned Len = strnlen(Data, MaxLen);

if (MaxLen == 0)
return std::nullopt;

// Check whether the buffer is null-terminated.
if (Len == MaxLen && Data[Len - 1])
return std::nullopt;
Expand Down