[clang] [clang][bytecode] Check ai32_bextr builtins for integer args (PR #113128)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 20 22:43:59 PDT 2024
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/113128
None
>From 89a268bbdbc0194c9d46abf7607b458320cd27ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 21 Oct 2024 07:42:40 +0200
Subject: [PATCH] [clang][bytecode] Check ai32_bextr builtins for integer args
---
clang/lib/AST/ByteCode/InterpBuiltin.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index c7b9dac5fec80c..10e33c14f4b455 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1253,6 +1253,10 @@ static bool interp__builtin_ia32_bextr(InterpState &S, CodePtr OpPC,
const InterpFrame *Frame,
const Function *Func,
const CallExpr *Call) {
+ if (!Call->getArg(0)->getType()->isIntegerType() ||
+ !Call->getArg(1)->getType()->isIntegerType())
+ return false;
+
PrimType ValT = *S.Ctx.classify(Call->getArg(0));
PrimType IndexT = *S.Ctx.classify(Call->getArg(1));
APSInt Val = peekToAPSInt(S.Stk, ValT,
More information about the cfe-commits
mailing list