[PATCH] D118692: [llvm-objcopy][COFF] Fix section name encoding
Nicolas Miller via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 1 05:09:32 PST 2022
npmiller added inline comments.
================
Comment at: llvm/tools/llvm-objcopy/COFF/Writer.cpp:173
+ // it adds a null termination character
+ snprintf(str, sizeof(S.Header.Name) + 1, "/%d", (int)offset);
+ } else if (offset <= MaxBase64Offset) {
----------------
mstorsjo wrote:
> Wouldn't this end up overwriting the first byte following `S.Header.Name`? (It might be benign to do that in practice here, but nevertheless, it would be better to not write outside of the intended struct fields.)
No because this is no writing to the struct field but to an intermediary string `str`. The correct amount of data is `memcpy`'d into the struct field from `str` a bit further down.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118692/new/
https://reviews.llvm.org/D118692
More information about the llvm-commits
mailing list