[clang] [clang][bytecode] Check number of addcarry/subborrow args (PR #111952)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 22:44:11 PDT 2024


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/111952

Apparently this can fail as well.

>From 129097176ae2673f8b6a5270edefbf6a787df55b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 11 Oct 2024 07:34:50 +0200
Subject: [PATCH] [clang][bytecode] Check number of addcarry/subborrow args

Apparently this can fail as well.
---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 1765193f5bebbc..74e9e1cf629372 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1287,7 +1287,7 @@ static bool interp__builtin_ia32_addcarry_subborrow(InterpState &S,
                                                     const InterpFrame *Frame,
                                                     const Function *Func,
                                                     const CallExpr *Call) {
-  if (!Call->getArg(0)->getType()->isIntegerType() ||
+  if (Call->getNumArgs() != 4 || !Call->getArg(0)->getType()->isIntegerType() ||
       !Call->getArg(1)->getType()->isIntegerType() ||
       !Call->getArg(2)->getType()->isIntegerType())
     return false;



More information about the cfe-commits mailing list