[llvm] r221872 - llvm-readobj: relocAddressLess could potentially lie

David Majnemer david.majnemer at gmail.com
Wed Nov 12 23:54:05 PST 2014


Author: majnemer
Date: Thu Nov 13 01:54:05 2014
New Revision: 221872

URL: http://llvm.org/viewvc/llvm-project?rev=221872&view=rev
Log:
llvm-readobj: relocAddressLess could potentially lie

On error conditions, relocAddressLess might claim that a value is less
than itself.  Instead, abort llvm-readobj.  No functionality change
intended.

Modified:
    llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp

Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=221872&r1=221871&r2=221872&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Thu Nov 13 01:54:05 2014
@@ -168,8 +168,8 @@ bool error(std::error_code EC) {
 
 bool relocAddressLess(RelocationRef a, RelocationRef b) {
   uint64_t a_addr, b_addr;
-  if (error(a.getOffset(a_addr))) return false;
-  if (error(b.getOffset(b_addr))) return false;
+  if (error(a.getOffset(a_addr))) exit(ReturnValue);
+  if (error(b.getOffset(b_addr))) exit(ReturnValue);
   return a_addr < b_addr;
 }
 





More information about the llvm-commits mailing list