[lld] r229912 - Fix heap-buffer-overflow bugs identified by the Address Sanitizer
Greg Fitzgerald
garious at gmail.com
Thu Feb 19 12:42:23 PST 2015
Author: garious
Date: Thu Feb 19 14:42:23 2015
New Revision: 229912
URL: http://llvm.org/viewvc/llvm-project?rev=229912&view=rev
Log:
Fix heap-buffer-overflow bugs identified by the Address Sanitizer
Differential Revision: http://reviews.llvm.org/D7733
Modified:
lld/trunk/lib/ReaderWriter/MachO/ArchHandler.cpp
lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
Modified: lld/trunk/lib/ReaderWriter/MachO/ArchHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler.cpp?rev=229912&r1=229911&r2=229912&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ArchHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler.cpp Thu Feb 19 14:42:23 2015
@@ -142,6 +142,8 @@ uint32_t ArchHandler::readU32(const uint
bool ArchHandler::isDwarfCIE(bool isBig, const DefinedAtom *atom) {
assert(atom->contentType() == DefinedAtom::typeCFI);
+ if (atom->rawContent().size() < sizeof(uint32_t))
+ return false;
uint32_t size = read32(atom->rawContent().data(), isBig);
uint32_t idOffset = sizeof(uint32_t);
Modified: lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp?rev=229912&r1=229911&r2=229912&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp Thu Feb 19 14:42:23 2015
@@ -411,6 +411,9 @@ private:
}
}
+ if (atom->rawContent().size() < 4 * sizeof(uint32_t))
+ return entry;
+
using normalized::read32;
entry.rangeLength =
read32(atom->rawContent().data() + 2 * sizeof(uint32_t), _isBig);
More information about the llvm-commits
mailing list