From: Jean-Marc Lasgouttes Date: Tue, 28 Mar 2017 09:17:35 +0000 (+0200) Subject: Limit the amount of derivatives in external CAS X-Git-Tag: 2.3.0alpha1~161 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=bc7704a78e32e67253847fdd3d163005fa615209;p=features.git Limit the amount of derivatives in external CAS The (arbitrary) limit is 1000. Pointed out by coverity. A bad value could lock LyX. --- diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index ee2004b508..da43bd4e35 100644 --- a/src/mathed/MathExtern.cpp +++ b/src/mathed/MathExtern.cpp @@ -896,6 +896,10 @@ void extractDiff(MathData & ar) int mult = 1; if (extractNumber(script->up(), mult)) { //lyxerr << "mult: " << mult << endl; + if (mult > 1000) { + lyxerr << "Cannot differentiate more than 1000 times !" << endl; + continue; + } for (int i = 0; i < mult; ++i) diff->addDer(MathData(buf, dt + 1, st)); }