forked from OSchip/llvm-project
[AbstractCallSite] Check that callback callee index is within call arguments
Summary: AbstractCallSite::getCallbackUses() does not check that callback callee index from the callback metadata does not exceed the total number of call arguments. This patch add such validation check. Reviewers: jdoerfert, sstefan1 Reviewed By: jdoerfert Subscribers: hiraditya, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D78112
This commit is contained in:
parent
d58107c3bf
commit
c1a9dd9aea
|
@ -48,7 +48,8 @@ void AbstractCallSite::getCallbackUses(ImmutableCallSite ICS,
|
||||||
auto *CBCalleeIdxAsCM = cast<ConstantAsMetadata>(OpMD->getOperand(0));
|
auto *CBCalleeIdxAsCM = cast<ConstantAsMetadata>(OpMD->getOperand(0));
|
||||||
uint64_t CBCalleeIdx =
|
uint64_t CBCalleeIdx =
|
||||||
cast<ConstantInt>(CBCalleeIdxAsCM->getValue())->getZExtValue();
|
cast<ConstantInt>(CBCalleeIdxAsCM->getValue())->getZExtValue();
|
||||||
CBUses.push_back(ICS.arg_begin() + CBCalleeIdx);
|
if (CBCalleeIdx < ICS.arg_size())
|
||||||
|
CBUses.push_back(ICS.arg_begin() + CBCalleeIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
; RUN: opt -S -openmpopt -stats < %s 2>&1 | FileCheck %s
|
; RUN: opt -S -openmpopt -stats < %s 2>&1 | FileCheck %s
|
||||||
|
; RUN: opt -S -attributor -attributor-disable=false -openmpopt -stats < %s 2>&1 | FileCheck %s
|
||||||
; REQUIRES: asserts
|
; REQUIRES: asserts
|
||||||
|
|
||||||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
|
Loading…
Reference in New Issue