Skip to content

Commit 18c1640

Browse files
authored
Merge pull request #19938 from theresa-m/invokeinterfacearray
Verification check for invokeinterface receiver
2 parents 51128c1 + 9a15c73 commit 18c1640

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

runtime/bcverify/rtverify.c

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,31 +1759,26 @@ verifyBytecodes (J9BytecodeVerificationData * verifyData)
17591759
}
17601760
break;
17611761
}
1762+
utf8string = J9ROMSTRINGREF_UTF8DATA(classRef);
17621763

1763-
if (bc != JBinvokeinterface) {
1764-
utf8string = J9ROMSTRINGREF_UTF8DATA(classRef);
1765-
1766-
rc = isClassCompatibleByName (verifyData, type, J9UTF8_DATA(utf8string), J9UTF8_LENGTH(utf8string), &reasonCode);
1767-
if (FALSE == rc) {
1768-
if (BCV_ERR_INSUFFICIENT_MEMORY == reasonCode) {
1769-
goto _outOfMemoryError;
1770-
}
1771-
errorType = J9NLS_BCV_ERR_RECEIVER_NOT_COMPATIBLE__ID;
1772-
/* Jazz 82615: Store the index of the expected data type for later retrieval in classNameList */
1773-
errorTargetType = convertClassNameToStackMapType(verifyData, J9UTF8_DATA(utf8string), J9UTF8_LENGTH(utf8string), 0, 0);
1774-
errorStackIndex = stackTop - liveStack->stackElements;
1775-
goto _inconsistentStack2;
1764+
rc = isClassCompatibleByName(verifyData, type, J9UTF8_DATA(utf8string), J9UTF8_LENGTH(utf8string), &reasonCode);
1765+
if (FALSE == rc) {
1766+
if (BCV_ERR_INSUFFICIENT_MEMORY == reasonCode) {
1767+
goto _outOfMemoryError;
17761768
}
1777-
} else {
1769+
errorType = J9NLS_BCV_ERR_RECEIVER_NOT_COMPATIBLE__ID;
1770+
/* Jazz 82615: Store the index of the expected data type for later retrieval in classNameList */
1771+
errorTargetType = convertClassNameToStackMapType(verifyData, J9UTF8_DATA(utf8string), J9UTF8_LENGTH(utf8string), 0, 0);
1772+
errorStackIndex = stackTop - liveStack->stackElements;
1773+
goto _inconsistentStack2;
1774+
}
1775+
if (JBinvokeinterface == bc) {
17781776
/* Throw a verify error for any of the following invokeinterface scenarios:
17791777
* 1. The top of the stack holds a base type or TOP
1780-
* 2. The top of the stack holds an array. Null type has a different meaning for arity bits.
1781-
* Don't fail at this point, a NullPointerException is expected later on.
1782-
* 3. The Object reference on the stack is uninitialized
1778+
* 2. The Object reference on the stack is uninitialized
17831779
* The check for the receiver to be an interface occurs in the bytecode interpreter.
17841780
*/
17851781
if ((BCV_TAG_BASE_TYPE_OR_TOP == (type & BCV_TAG_MASK))
1786-
|| ((type != BCV_BASE_TYPE_NULL) && (BCV_ARITY_FROM_TYPE(type) > 0))
17871782
|| J9_ARE_ANY_BITS_SET(type, BCV_SPECIAL)
17881783
) {
17891784
errorType = J9NLS_BCV_ERR_RECEIVER_NOT_COMPATIBLE__ID;

0 commit comments

Comments
 (0)