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

Side by Side Diff: lib/Bitcode/NaCl/Reader/NaClBitCodes.cpp

Issue 932953002: Fix the NaCl bitstream reader to report fatal errors. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Merge with master Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- NaClBitcodeHeader.cpp ----------------------------------------------===// 1 //===- NaClBitcodeHeader.cpp ----------------------------------------------===//
2 // PNaCl bitcode header reader. 2 // PNaCl bitcode header reader.
3 // 3 //
4 // The LLVM Compiler Infrastructure 4 // The LLVM Compiler Infrastructure
5 // 5 //
6 // This file is distributed under the University of Illinois Open Source 6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details. 7 // License. See LICENSE.TXT for details.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 Abbrev->OperandList.push_back(Op); 114 Abbrev->OperandList.push_back(Op);
115 } 115 }
116 return Abbrev; 116 return Abbrev;
117 } 117 }
118 118
119 bool NaClBitCodeAbbrev::isValid() const { 119 bool NaClBitCodeAbbrev::isValid() const {
120 // Verify that an array op appears can only appear if it is the 120 // Verify that an array op appears can only appear if it is the
121 // second to last element. 121 // second to last element.
122 unsigned NumOperands = getNumOperandInfos(); 122 unsigned NumOperands = getNumOperandInfos();
123 if (NumOperands == 0) return false;
123 for (unsigned i = 0; i < NumOperands; ++i) { 124 for (unsigned i = 0; i < NumOperands; ++i) {
124 const NaClBitCodeAbbrevOp &Op = getOperandInfo(i); 125 const NaClBitCodeAbbrevOp &Op = getOperandInfo(i);
125 if (Op.isArrayOp() && i + 2 != NumOperands) 126 if (Op.isArrayOp() && i + 2 != NumOperands)
126 return false; 127 return false;
127 } 128 }
128 return true; 129 return true;
129 } 130 }
OLDNEW
« no previous file with comments | « lib/Bitcode/NaCl/Analysis/NaClObjDumpStream.cpp ('k') | lib/Bitcode/NaCl/Reader/NaClBitcodeParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698