1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
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));
|