Skip to content

Commit dae76b1

Browse files
committed
[clang][Interp] ArrayElemPtr should also do null check on the descriptor
1 parent 0076d68 commit dae76b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/AST/ByteCode/Interp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3096,7 +3096,8 @@ inline bool ArrayElemPtr(InterpState &S, CodePtr OpPC) {
30963096
}
30973097

30983098
if (Offset.isZero()) {
3099-
if (Ptr.getFieldDesc()->isArray() && Ptr.getIndex() == 0) {
3099+
if (const Descriptor *Desc = Ptr.getFieldDesc();
3100+
Desc && Desc->isArray() && Ptr.getIndex() == 0) {
31003101
S.Stk.push<Pointer>(Ptr.atIndex(0).narrow());
31013102
return true;
31023103
}

0 commit comments

Comments
 (0)