diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-05-01 07:35:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-01 07:35:33 +0200 |
commit | c51be1be3ac9c66fc0c598298edd1fd224c1da07 (patch) | |
tree | 778c7149fd066431a475788dc99b4a913dbffcb5 /clang/lib/AST/ByteCode/Interp.cpp | |
parent | d0a97271a4ea2b0fe392afe498af20f8499260d2 (diff) | |
download | llvm-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.cpp | 2 |
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)); |