From 9686547f3d3dbb1e6fe05fe254a83b3dae820acf Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Mon, 15 Mar 2021 15:05:24 +0900 Subject: [PATCH] sw_engine rleClipPath: Modify clippath spans creation size. When updating rle for clipped area, realloc size should be larger than spans size. so this patch prevents the problem while realloc. --- src/lib/sw_engine/tvgSwRle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/sw_engine/tvgSwRle.cpp b/src/lib/sw_engine/tvgSwRle.cpp index e89590b..846bca4 100644 --- a/src/lib/sw_engine/tvgSwRle.cpp +++ b/src/lib/sw_engine/tvgSwRle.cpp @@ -923,8 +923,9 @@ void updateRleSpans(SwRleData *rle, const SwSpan* curSpans, uint32_t size) } if (!rle->spans || !curSpans) return; + rle->alloc = size * 2; + rle->spans = static_cast(realloc(rle->spans, rle->alloc * sizeof(SwSpan))); rle->size = size; - rle->spans = static_cast(realloc(rle->spans, rle->size * sizeof(SwSpan))); if (!rle->spans) return; -- 2.7.4