[PATCH] D118692: [llvm-objcopy][COFF] Fix section name encoding

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 05:00:27 PST 2022


mstorsjo 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) {
----------------
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.)


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