Skip to content

Commit

Permalink
Merge pull request #3051 from JasonFengJ9/setdc
Browse files Browse the repository at this point in the history
Set domainCombiner from closest frame in result AccessControlContext
  • Loading branch information
pshipton authored Sep 27, 2018
2 parents 6361f91 + 9254b4c commit 450399b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ private static AccessControlContext getContextHelper(boolean forDoPrivilegedWith
int frameNbr = domains.length / OBJS_ARRAY_SIZE;
AccessControlContext accContext = null;
AccessControlContext accLower = null;
DomainCombiner dc = null; // store a non-null domainCombiner from a closest frame or null
for (int j = 0; j < frameNbr; ++j) {
AccessControlContext acc = (AccessControlContext) domains[j * OBJS_ARRAY_SIZE];
/*[PR JAZZ 66930] j.s.AccessControlContext.checkPermission() invoke untrusted ProtectionDomain.implies */
Expand All @@ -486,6 +487,10 @@ private static AccessControlContext getContextHelper(boolean forDoPrivilegedWith
}
if (null != acc && null != acc.domainCombiner) {
accTmp.domainCombiner = acc.domainCombiner;
if (dc == null) {
// this dc will be set to accContext.domainCombiner
dc = acc.domainCombiner;
}
}
if (null != domains[j * OBJS_ARRAY_SIZE + OBJS_INDEX_PERMS_OR_CACHECHECKED]) {
// this is frame with limited permissions
Expand All @@ -500,7 +505,9 @@ private static AccessControlContext getContextHelper(boolean forDoPrivilegedWith
}
accLower = accTmp;
}

if ((accContext != null) && (accContext.domainCombiner == null) && (dc != null)) {
accContext.domainCombiner = dc;
}
return accContext;
}

Expand Down

0 comments on commit 450399b

Please sign in to comment.