[PATCH] D41270: Fix buffer overrun in WindowsResourceCOFFWriter::writeSymbolTable()
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 19:56:56 PST 2017
ruiu added inline comments.
================
Comment at: llvm/lib/Object/WindowsResource.cpp:564
char RelocationName[9];
- sprintf(RelocationName, "$R%06X", DataOffsets[i]);
+ sprintf(RelocationName, "$R%06X", DataOffsets[i] & 0xffffff);
Symbol = reinterpret_cast<coff_symbol16 *>(BufferStart + CurrentOffset);
----------------
There seems to be a small chance that this line could create duplicate names, and if two symbols have the same name, something strange could happen. As we discussed, I think it is better to use `i` instead of `DataOffsets[i]` to generate a naem.
https://reviews.llvm.org/D41270
More information about the llvm-commits
mailing list