From aecbdf70bfd3dbba8fe5c902046188821513e1b8 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 5 Jul 2016 00:23:05 +0000 Subject: Object: support empty UID/GID fields Normal archives do not have empty UID/GID fields. However, the Microsoft Import library format is a customized archive (it just uses an alternate symbol index format). When the import library is constructed by lib.exe, the UID and GID fields are left empty. Do not abort on such an input. llvm-svn: 274528 --- llvm/lib/Object/Archive.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Object/Archive.cpp') diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 4e9a18ee40c..4720bf894e9 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -69,14 +69,20 @@ sys::TimeValue ArchiveMemberHeader::getLastModified() const { unsigned ArchiveMemberHeader::getUID() const { unsigned Ret; - if (StringRef(UID, sizeof(UID)).rtrim(' ').getAsInteger(10, Ret)) + StringRef User = StringRef(UID, sizeof(UID)).rtrim(' '); + if (User.empty()) + return 0; + if (User.getAsInteger(10, Ret)) llvm_unreachable("UID time not a decimal number."); return Ret; } unsigned ArchiveMemberHeader::getGID() const { unsigned Ret; - if (StringRef(GID, sizeof(GID)).rtrim(' ').getAsInteger(10, Ret)) + StringRef Group = StringRef(GID, sizeof(GID)).rtrim(' '); + if (Group.empty()) + return 0; + if (Group.getAsInteger(10, Ret)) llvm_unreachable("GID time not a decimal number."); return Ret; } -- cgit v1.2.3