[lld] r176747 - [Writer][ELF] Use correct data types for sizes. Fixes integer overflow bug.
Michael J. Spencer
bigcheesegs at gmail.com
Fri Mar 8 17:41:17 PST 2013
Author: mspencer
Date: Fri Mar 8 19:41:16 2013
New Revision: 176747
URL: http://llvm.org/viewvc/llvm-project?rev=176747&view=rev
Log:
[Writer][ELF] Use correct data types for sizes. Fixes integer overflow bug.
This only happens when the section header count is > 1024.
Modified:
lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
Modified: lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h?rev=176747&r1=176746&r2=176747&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h Fri Mar 8 19:41:16 2013
@@ -259,13 +259,13 @@ public:
void finalize() {}
- inline uint16_t fileSize() { return sizeof(Elf_Shdr) * _sectionInfo.size(); }
+ inline uint64_t fileSize() { return sizeof(Elf_Shdr) * _sectionInfo.size(); }
- inline int64_t entsize() {
+ inline uint64_t entsize() {
return sizeof(Elf_Shdr);
}
- inline int64_t numHeaders() {
+ inline uint64_t numHeaders() {
return _sectionInfo.size();
}
More information about the llvm-commits
mailing list