From: Tudor Bosman Date: Fri, 19 Sep 2014 19:58:10 +0000 (-0700) Subject: Do not barf on invalid ELF files X-Git-Tag: v0.22.0~347 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=00a4fa1bc4e55b29317a45e6cd9caa32eeba321c;p=folly.git Do not barf on invalid ELF files Summary: The Haskell runtime does magic, and loads an ET_REL file directly. Test Plan: ran it Reviewed By: jon.coens@fb.com Subscribers: njormrod, rkroll FB internal diff: D1566853 Tasks: 4401996 @override-unit-failures --- diff --git a/folly/experimental/symbolizer/ElfCache.cpp b/folly/experimental/symbolizer/ElfCache.cpp index d56f91ae..713cd1d4 100644 --- a/folly/experimental/symbolizer/ElfCache.cpp +++ b/folly/experimental/symbolizer/ElfCache.cpp @@ -49,10 +49,9 @@ std::shared_ptr SignalSafeElfCache::getFile(StringPiece p) { const char* msg = ""; int r = f->openNoThrow(path.data(), true, &msg); - if (r == ElfFile::kSystemError) { + if (r != ElfFile::kSuccess) { return nullptr; } - FOLLY_SAFE_CHECK(r == ElfFile::kSuccess, msg); map_[path] = n; return f; @@ -79,10 +78,9 @@ std::shared_ptr ElfCache::getFile(StringPiece p) { // No negative caching const char* msg = ""; int r = entry->file.openNoThrow(path.c_str(), true, &msg); - if (r == ElfFile::kSystemError) { + if (r != ElfFile::kSuccess) { return nullptr; } - FOLLY_SAFE_CHECK(r == ElfFile::kSuccess, msg); if (files_.size() == capacity_) { auto& e = lruList_.front();