Check both lower and upper bound for tainted loop limit

In these cases, the lower bound is not that important, but coverity insists on it.
This commit is contained in:
Jean-Marc Lasgouttes 2017-04-05 10:22:52 +02:00 committed by Jean-Marc Lasgouttes
parent abc0aaec12
commit 7b0e732eeb
2 changed files with 3 additions and 3 deletions

View File

@ -896,8 +896,8 @@ 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;
if (mult < 0 || mult > 1000) {
lyxerr << "Cannot differentiate less than 0 or more than 1000 times !" << endl;
continue;
}
for (int i = 0; i < mult; ++i)

View File

@ -1375,7 +1375,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
parse(count, FLAG_ITEM, mode);
int cols;
// limit arbitrarily to 100 columns
if (extractNumber(count, cols) && cols < 100) {
if (extractNumber(count, cols) && cols > 0 && cols < 100) {
// resize the table if necessary
size_t first = grid.index(cellrow, cellcol);
for (int i = 1; i < cols; ++i) {