Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Issue 932953002: Fix the NaCl bitstream reader to report fatal errors. (Closed)

Created:
5 years, 10 months ago by Karl
Modified:
5 years, 7 months ago
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix the NaCl bitstream reader to report fatal errors. The current code has several asserts on bitcode file read values. This results in assert errors for badly user-defined input, causing the application to crash. This CL Fixes this problem by providing an error handling class (that can be overridden) to define how fatal errors should be handled by the bitstream reader. It also consolidates the printing of bit addresses into one place, and then uses this to prefix (default) bitstream error messages. It also fixes a bug where the NaClBitcodeReader/NaClBitcodeParser bit positions were relative to the first bit after the header, rather than at the beginning of the bitcode file. This fixes pnacl-bcdis from core dumping on bitcode file specified in bug 4002, since it has an illegal abbreviation index in the bitcode file. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4002 R=jvoung@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-llvm.git;a=commit;h=fad799848e661f81adfeca53660cd5b454928380

Patch Set 1 #

Patch Set 2 : Allow bit position to be associated with parse errors. #

Patch Set 3 : Fix nits and comments. #

Patch Set 4 : Fix cursor placement and add unit tests. #

Patch Set 5 : Fix nits. #

Patch Set 6 : Fix formatting. #

Total comments: 35

Patch Set 7 : Fix issues raised in last patch. #

Patch Set 8 : Fix nits. #

Total comments: 12

Patch Set 9 : Fix issues raised in patch set 8. #

Total comments: 2

Patch Set 10 : Fix nit in last patch. #

Patch Set 11 : Updated patch after LLVM 3.6 merge #

Patch Set 12 : Port to LLVM 3.6 #

Patch Set 13 : Merge with master #

Unified diffs Side-by-side diffs Delta from patch set Stats (+494 lines, -194 lines) Patch
M include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +21 lines, -1 line 0 comments Download
M include/llvm/Bitcode/NaCl/NaClBitcodeParser.h View 1 2 3 4 5 6 7 8 4 chunks +49 lines, -8 lines 0 comments Download
M include/llvm/Bitcode/NaCl/NaClBitstreamReader.h View 1 2 3 4 5 6 7 8 9 10 8 chunks +58 lines, -4 lines 0 comments Download
M include/llvm/Bitcode/NaCl/NaClObjDumpStream.h View 1 2 3 4 5 6 8 chunks +7 lines, -34 lines 0 comments Download
M lib/Bitcode/NaCl/Analysis/NaClObjDump.cpp View 1 2 3 4 5 6 8 chunks +24 lines, -21 lines 0 comments Download
M lib/Bitcode/NaCl/Analysis/NaClObjDumpStream.cpp View 1 2 3 4 5 6 7 chunks +5 lines, -20 lines 0 comments Download
M lib/Bitcode/NaCl/Reader/NaClBitCodes.cpp View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M lib/Bitcode/NaCl/Reader/NaClBitcodeParser.cpp View 1 1 chunk +13 lines, -0 lines 0 comments Download
M lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -2 lines 0 comments Download
M lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp View 1 2 3 4 5 6 7 8 8 chunks +60 lines, -20 lines 0 comments Download
M lib/Bitcode/NaCl/TestUtils/NaClBitcodeMunge.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +37 lines, -6 lines 0 comments Download
M unittests/Bitcode/CMakeLists.txt View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
A unittests/Bitcode/NaClAbbrevErrorTests.cpp View 1 2 3 4 5 6 7 8 1 chunk +93 lines, -0 lines 0 comments Download
M unittests/Bitcode/NaClParseInstsTest.cpp View 1 2 3 4 5 6 7 chunks +108 lines, -69 lines 0 comments Download
M unittests/Bitcode/NaClParseTypesTest.cpp View 1 2 3 4 5 2 chunks +13 lines, -9 lines 0 comments Download

Messages

Total messages: 9 (1 generated)
Karl
5 years, 10 months ago (2015-02-19 21:21:26 UTC) #2
jvoung (off chromium)
https://codereview.chromium.org/932953002/diff/100001/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h File include/llvm/Bitcode/NaCl/NaClBitcodeParser.h (right): https://codereview.chromium.org/932953002/diff/100001/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h#newcode418 include/llvm/Bitcode/NaCl/NaClBitcodeParser.h:418: // Redirects bitstream reader errors to corresponding parrser error ...
5 years, 10 months ago (2015-02-20 00:12:42 UTC) #3
Karl
https://codereview.chromium.org/932953002/diff/100001/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h File include/llvm/Bitcode/NaCl/NaClBitcodeParser.h (right): https://codereview.chromium.org/932953002/diff/100001/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h#newcode418 include/llvm/Bitcode/NaCl/NaClBitcodeParser.h:418: // Redirects bitstream reader errors to corresponding parrser error ...
5 years, 10 months ago (2015-02-20 21:41:18 UTC) #4
jvoung (off chromium)
https://codereview.chromium.org/932953002/diff/140001/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h File include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h (right): https://codereview.chromium.org/932953002/diff/140001/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h#newcode227 include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h:227: /// errstream so that they can be tested. "errs()" ...
5 years, 10 months ago (2015-02-23 18:58:56 UTC) #5
Karl
https://codereview.chromium.org/932953002/diff/140001/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h File include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h (right): https://codereview.chromium.org/932953002/diff/140001/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h#newcode227 include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h:227: /// errstream so that they can be tested. On ...
5 years, 10 months ago (2015-02-23 20:46:23 UTC) #6
jvoung (off chromium)
LGTM but please wait until the chrome 42 regression has been fixed before landing: https://code.google.com/p/nativeclient/issues/detail?id=4105 ...
5 years, 10 months ago (2015-02-23 22:57:38 UTC) #7
Karl
Ready to commit once regression in chrome 42 fixed. https://codereview.chromium.org/932953002/diff/160001/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h File include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h (right): https://codereview.chromium.org/932953002/diff/160001/include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h#newcode143 include/llvm/Bitcode/NaCl/NaClBitcodeMunge.h:143: ...
5 years, 10 months ago (2015-02-23 23:09:01 UTC) #8
Karl
5 years, 9 months ago (2015-03-04 20:18:22 UTC) #9
Message was sent while issue was closed.
Committed patchset #13 (id:240001) manually as
fad799848e661f81adfeca53660cd5b454928380 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698