[PATCH] D127369: [Object][COFF] Fix section name parsing error when the name field is not null-padded
Pengxuan Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 9 15:23:33 PDT 2022
pzheng added inline comments.
================
Comment at: llvm/lib/Object/COFFObjectFile.cpp:1171
} else {
- if (Name.substr(1).getAsInteger(10, Offset))
return createStringError(object_error::parse_failed,
----------------
rnk wrote:
> I think it's a bug that getAsInteger doesn't work on non-null terminated StringRefs. It's not an invariant that StringRefs are null terminated. We explicitly form a non-null terminated StringRef on line 1161 above.
hmm..., not sure if getAsInteger is supposed to handle a situation like this, the description of the function isn't very clear, but I tend to agree with you that this could be bug unless there are already code in LLVM which assumes getAsInteger should fail given such input.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127369/new/
https://reviews.llvm.org/D127369
More information about the llvm-commits
mailing list