Skip to content

Commit 3964b99

Browse files
author
Akira Saitoh
committed
Add bound check before accessing flags array of InterpreterEmulator
`InterpreterEmulator::findNextByteCodeToVisit()` accesses `_InterpreterEmulatorFlags` twice. Before the second one, `_bcIndex` can be modified with the value returned by `findNextByteCodeToGen()`. The value can be larger than `_maxByteCodeIndex`, which causes an out of bounds access. This commit adds a bound check before the second access to `_InterpreterEmulatorFlags`. Signed-off-by: Akira Saitoh <saiaki@jp.ibm.com>
1 parent 9bb046c commit 3964b99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

runtime/compiler/optimizer/InterpreterEmulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ InterpreterEmulator::findNextByteCodeToVisit()
12401240
else next();
12411241
}
12421242

1243-
if (_InterpreterEmulatorFlags[_bcIndex].testAny(InterpreterEmulator::BytecodePropertyFlag::bbStart))
1243+
if (_bcIndex < _maxByteCodeIndex && _InterpreterEmulatorFlags[_bcIndex].testAny(InterpreterEmulator::BytecodePropertyFlag::bbStart))
12441244
{
12451245
if (isGenerated(_bcIndex))
12461246
setIndex(Base::findNextByteCodeToGen());

0 commit comments

Comments
 (0)