[PATCH] Avoid crash reading bitcode files with bad abbrev record (bug 20485)

Filipe Cabecinhas filcab+llvm.phabricator at gmail.com
Fri Jan 16 09:15:59 PST 2015


This looks good, minus the formatting in some places. Rafael's hint should help :-)
Please also change the report_fatal_error back into llvm_unreachable in include/llvm/Bitcode/BitCodes.h:128, since we're not supposed to get to that point anymore (You'll also have to remove the invalid.test Bitcode test, and test/Bitcode/Inputs/invalid-pr20485.bc)

Thanks for improving this!


================
Comment at: include/llvm/Bitcode/BitCodes.h:99
@@ -98,2 +98,3 @@
   };
+  static bool isValidEncoding(Encoding Enc) { return  0 < (int) Enc && (int)Enc <= (int)Blob; }
 
----------------
Please run clang-format here too.

================
Comment at: test/Bitcode/bad-abbrev-record.txt:2
@@ +1,3 @@
+; RUN: not llvm-dis < %s.bc 2>&1 | FileCheck %s
+; CHECK: llvm-dis: Malformed block
+
----------------
Shouldn't it be "malformed bitcode file"?

http://reviews.llvm.org/D7003

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list