aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2013-01-10 00:07:38 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2013-01-10 00:07:38 +0000
commitbf82b07f5f2ff1ebd3fb607a9f0d31d2b5ada947 (patch)
tree549ea4d789669dfe132a6637084b3675ec8196cb
parent1db9b6957c2565a2322206bd5907530895f1c7ac (diff)
[Object][Archive] Apparently StringRef::getAsInteger for APInt accepts spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172022 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Object/Archive.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp
index 95eba625ed..0d12be8f04 100644
--- a/lib/Object/Archive.cpp
+++ b/lib/Object/Archive.cpp
@@ -49,7 +49,7 @@ struct ArchiveMemberHeader {
uint64_t getSize() const {
uint64_t ret;
- StringRef(Size, sizeof(Size)).getAsInteger(10, ret);
+ StringRef(Size, sizeof(Size)).rtrim(" ").getAsInteger(10, ret);
return ret;
}
};
@@ -110,7 +110,7 @@ error_code Archive::Child::getName(StringRef &Result) const {
}
// It's a long name.
// Get the offset.
- uint64_t offset;
+ std::size_t offset;
name.substr(1).getAsInteger(10, offset);
const char *addr = Parent->StringTable->Data.begin()
+ sizeof(ArchiveMemberHeader)
@@ -218,6 +218,10 @@ Archive::Archive(MemoryBuffer *source, error_code &ec)
SymbolTable = i;
StringTable = e;
if (i != e) ++i;
+ if (i == e) {
+ ec = object_error::parse_failed;
+ return;
+ }
if ((ec = i->getName(name)))
return;
if (name[0] != '/') {