fix: prevent stack overflow in type inference if update tree is too deep

This commit is contained in:
Skylot
2019-05-11 22:34:36 +03:00
parent 119709b844
commit 0ca2789a18
@@ -151,6 +151,12 @@ public final class TypeUpdate {
return CHANGED;
}
updateInfo.requestUpdate(arg, candidateType);
if (updateInfo.getUpdates().size() > 500) {
if (Consts.DEBUG) {
LOG.error("Type update error: too deep update tree");
}
return REJECT;
}
try {
TypeUpdateResult result = runListeners(updateInfo, arg, candidateType);
if (result == REJECT) {