[poincare] Add recursion protection around Exp:getPolyReducedCoefs

This commit is contained in:
Léa Saviot
2018-11-08 18:00:42 +01:00
committed by Émilie Feral
parent ada8f5f3c4
commit 4ede2f8b86

View File

@@ -295,10 +295,18 @@ int Expression::defaultGetPolynomialCoefficients(Context & context, const char *
}
int Expression::getPolynomialReducedCoefficients(const char * symbolName, Expression coefficients[], Context & context, Preferences::AngleUnit angleUnit) const {
// Reset recursion count if needed
bool willHaveToUnlock = ResetRecursionCountAndLockReset();
int degree = getPolynomialCoefficients(context, symbolName, coefficients);
for (int i = 0; i <= degree; i++) {
coefficients[i] = coefficients[i].deepReduce(context, angleUnit);
}
// Unlock recursion count reinitialization if needed
if (willHaveToUnlock) {
UnlockRecursionCountReset();
}
return degree;
}