Description: Touch up some incorrect values that result to assertion violations
Author: Nicholas Guriev <guriev-ns@ya.ru>
Last-Modified: Fri, 04 Mar 2022 18:11:48 +0300

--- a/src/lottie/lottiemodel.h
+++ b/src/lottie/lottiemodel.h
@@ -1025,16 +1025,16 @@ public:
     LOTTrimData::TrimType type() const {return mTrimType;}
 private:
     Segment noloop(float start, float end) const{
-        assert(start >= 0);
-        assert(end >= 0);
+        if (!(start >= 0)) start = 0;
+        if (!(end >= 0)) end = 0;
         Segment s;
         s.start = std::min(start, end);
         s.end = std::max(start, end);
         return s;
     }
     Segment loop(float start, float end) const{
-        assert(start >= 0);
-        assert(end >= 0);
+        if (!(start >= 0)) start = 0;
+        if (!(end >= 0)) end = 0;
         Segment s;
         s.start = std::max(start, end);
         s.end = std::min(start, end);
--- a/src/vector/freetype/v_ft_stroker.cpp
+++ b/src/vector/freetype/v_ft_stroker.cpp
@@ -18,6 +18,7 @@
 
 #include "v_ft_stroker.h"
 #include <assert.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 #include "v_ft_math.h"
@@ -631,6 +632,8 @@ Fail:
 static void ft_stroke_border_export(SW_FT_StrokeBorder border,
                                     SW_FT_Outline*     outline)
 {
+    if ((ulong)outline->n_points + border->num_points > SHRT_MAX) return;
+
     /* copy point locations */
     memcpy(outline->points + outline->n_points, border->points,
            border->num_points * sizeof(SW_FT_Vector));
