]> git.lyx.org Git - lyx.git/commitdiff
Limit the number of iterations for some tabular features in math
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 11 Sep 2024 11:29:20 +0000 (13:29 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 11 Sep 2024 11:29:20 +0000 (13:29 +0200)
Try to please Coverity scan.

development/coverity_modeling.cpp
src/mathed/InsetMathGrid.cpp

index 984464655a88e49535bcd45c2439c5c5cd30dc3e..7e8cb632312f9c7f76b2c0906539705262e3a198 100644 (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__();
+}
+
+
+
 }
index c775ff4943c2b24f4a85b5cb583d47f253c89a56..f17702a1695a679e578205b9990add89ee82ab35 100644 (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)
 {
        int num = 1;
        is >> num;
-       return (num == 0) ? 1 : num;
+       return min(max(num, 1), 1000);
 }