Limit the number of iterations for some tabular features in math

Try to please Coverity scan.
This commit is contained in:
Jean-Marc Lasgouttes 2024-09-11 13:29:20 +02:00
parent 3f5b836aa9
commit 716e20ae1b
2 changed files with 13 additions and 1 deletions

View File

@ -36,4 +36,15 @@ void lyxbreaker(void const * data, const char * hint, int size)
} }
template<class T>
void CoordCache<T>::check(T const * thing, char const * hint) const
{
typename cache_type::const_iterator it = data_.find(thing);
if (it == data_.end() || it->second.pos.x == -10000)
__coverity_panic__();
}
} }

View File

@ -59,11 +59,12 @@ static docstring verboseHLine(int n)
} }
// read a number to be used as an iteration count (limited arbitrary to 1000)
static int extractInt(istream & is) static int extractInt(istream & is)
{ {
int num = 1; int num = 1;
is >> num; is >> num;
return (num == 0) ? 1 : num; return min(max(num, 1), 1000);
} }