Skip to content

Commit

Permalink
Merge pull request #10524 from keithc-ca/cast-0.22
Browse files Browse the repository at this point in the history
(0.22.0) Fix compile error
  • Loading branch information
DanHeidinga authored Sep 4, 2020
2 parents 2d2f8b8 + 8120779 commit 02aced1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions runtime/bcverify/vrfyhelp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,16 +1023,16 @@ isProtectedAccessPermitted(J9BytecodeVerificationData *verifyData, J9UTF8* decla
if (currentRamClass->packageID == definingRamClass->packageID) return TRUE;

/* Determine if the defining class is the same class or a super class of current class */
if (isSameOrSuperClassOf (definingRamClass, currentRamClass)) {
U_8 * targetClassName;
UDATA targetClassLength;
J9Class * targetRamClass;
if (isSameOrSuperClassOf(definingRamClass, currentRamClass)) {
U_8 * targetClassName = NULL;
UDATA targetClassLength = 0;
J9Class * targetRamClass = NULL;

/* NULL is compatible */
if (targetClass != BCV_BASE_TYPE_NULL) {
/* Get the targetRamClass */
getNameAndLengthFromClassNameList (verifyData, J9CLASS_INDEX_FROM_CLASS_ENTRY(targetClass), &targetClassName, &targetClassLength);
targetRamClass = j9rtv_verifierGetRAMClass (verifyData, verifyData->classLoader, targetClassName, targetClassLength, reasonCode);
getNameAndLengthFromClassNameList(verifyData, J9CLASS_INDEX_FROM_CLASS_ENTRY(targetClass), &targetClassName, &targetClassLength);
targetRamClass = j9rtv_verifierGetRAMClass(verifyData, verifyData->classLoader, targetClassName, targetClassLength, reasonCode);
if (NULL == targetRamClass) {
return FALSE;
}
Expand All @@ -1041,14 +1041,12 @@ isProtectedAccessPermitted(J9BytecodeVerificationData *verifyData, J9UTF8* decla
/* flipped logic - currentRamClass is the same class or a super class of the target class */
if (J9ROMCLASS_IS_HIDDEN(romClass)) {
currentClassName = J9ROMCLASS_CLASSNAME(romClass);
if ((targetClassLength != J9UTF8_LENGTH(currentClassName))
|| (0 != strncmp(J9UTF8_DATA(currentClassName), targetClassName, targetClassLength))
) {
if (J9UTF8_DATA_EQUALS(targetClassName, targetClassLength, J9UTF8_DATA(currentClassName), J9UTF8_LENGTH(currentClassName))) {
/* fail if current class and target class are not the same */
return FALSE;
}
} else {
if (!isSameOrSuperClassOf (currentRamClass, targetRamClass)) {
if (!isSameOrSuperClassOf(currentRamClass, targetRamClass)) {
/* fail */
return FALSE;
}
Expand Down

0 comments on commit 02aced1

Please sign in to comment.