aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Interp.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-01 07:35:33 +0200
committerGitHub <noreply@github.com>2025-05-01 07:35:33 +0200
commitc51be1be3ac9c66fc0c598298edd1fd224c1da07 (patch)
tree778c7149fd066431a475788dc99b4a913dbffcb5 /clang/lib/AST/ByteCode/Interp.cpp
parentd0a97271a4ea2b0fe392afe498af20f8499260d2 (diff)
downloadllvm-c51be1be3ac9c66fc0c598298edd1fd224c1da07.zip
llvm-c51be1be3ac9c66fc0c598298edd1fd224c1da07.tar.gz
llvm-c51be1be3ac9c66fc0c598298edd1fd224c1da07.tar.bz2
[clang][bytecode] Fix checking for integer overflow (#137962)
We need to evaluate both the True/False expressions of a conditional operator as well as the LHS/RHS of a binary operator in more cases.
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Interp.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 62b4495..1a7fc6c 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1336,7 +1336,7 @@ static bool getField(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
return false;
}
- if (Off > Ptr.block()->getSize())
+ if ((Ptr.getByteOffset() + Off) >= Ptr.block()->getSize())
return false;
S.Stk.push<Pointer>(Ptr.atField(Off));