C: fix bug in exception handling

This commit is contained in:
Alexey Andreev 2019-10-31 14:18:29 +03:00
parent 81cc3c156e
commit beef9e09ca
2 changed files with 3 additions and 7 deletions

View File

@ -499,7 +499,7 @@ public class CodeGenerationVisitor implements ExprVisitor, StatementVisitor {
pushLocation(expr.getLocation()); pushLocation(expr.getLocation());
if (needsCallSiteId() && context.getCharacteristics().isManaged(expr.getMethod())) { if (needsCallSiteId() && isManagedMethodCall(context.getCharacteristics(), expr.getMethod())) {
needParenthesis = true; needParenthesis = true;
withCallSite(); withCallSite();
} }

View File

@ -283,17 +283,13 @@ public class ExceptionHandlingShadowStackContributor {
|| insn instanceof NullCheckInstruction || insn instanceof BoundCheckInstruction) { || insn instanceof NullCheckInstruction || insn instanceof BoundCheckInstruction) {
return true; return true;
} else if (insn instanceof InvokeInstruction) { } else if (insn instanceof InvokeInstruction) {
MethodReference method = ((InvokeInstruction) insn).getMethod(); return isManagedMethodCall(characteristics, ((InvokeInstruction) insn).getMethod());
if (method.equals(FILL_STACK_TRACE)) {
return true;
}
return isManagedMethodCall(characteristics, method);
} }
return false; return false;
} }
public static boolean isManagedMethodCall(Characteristics characteristics, MethodReference method) { public static boolean isManagedMethodCall(Characteristics characteristics, MethodReference method) {
if (characteristics.isManaged(method)) { if (characteristics.isManaged(method) || method.equals(FILL_STACK_TRACE)) {
return true; return true;
} }
return method.getClassName().equals(ExceptionHandling.class.getName()) return method.getClassName().equals(ExceptionHandling.class.getName())