Limit the amount of derivatives in external CAS

The (arbitrary) limit is 1000.

Pointed out by coverity. A bad value could lock LyX.
This commit is contained in:
Jean-Marc Lasgouttes 2017-03-28 11:17:35 +02:00
parent 5c03cb340c
commit bc7704a78e

View File

@ -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));
}