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

Unified Diff: lib/Transforms/NaCl/ReplacePtrsWithInts.cpp

Issue 1085483003: PNaCl: Check we don't crash in -replace-ptrs-with-ints with odd metadata operands. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
diff --git a/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp b/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
index 53f0d1d809e9b89f52d486c10eb67e21c5c33926..68b5fe6d3c5c30529970166ed31786a500ae99ac 100644
--- a/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
+++ b/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp
@@ -286,6 +286,9 @@ void FunctionConverter::eraseReplacedInstructions() {
static void ConvertMetadataOperand(FunctionConverter *FC,
IntrinsicInst *Call, int Index) {
MDNode *MD = cast<MDNode>(Call->getArgOperand(Index));
+ if (!isa<MDNode>(MDVal->getMetadata())) {
+ return;
+ }
JF 2015/04/22 17:48:29 MDVal isn't a valid value here.
if (MD->getNumOperands() != 1)
return;
Value *MDArg = MD->getOperand(0);
« no previous file with comments | « no previous file | test/Transforms/NaCl/replace-ptrs-with-ints.ll » ('j') | test/Transforms/NaCl/replace-ptrs-with-ints.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698