From: John Preston Date: Sun, 1 Sep 2019 09:04:26 +0000 (+0300) Subject: Fix possible stack corruption. X-Git-Tag: submit/tizen/20190923.005744~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f3c96f213233f62dd1acb6fb3c2b593c53cc74e;p=platform%2Fcore%2Fuifw%2Flottie-player.git Fix possible stack corruption. --- diff --git a/src/lottie/lottieparser.cpp b/src/lottie/lottieparser.cpp index 622cf2b..50776f7 100644 --- a/src/lottie/lottieparser.cpp +++ b/src/lottie/lottieparser.cpp @@ -1709,13 +1709,16 @@ void LottieParserImpl::getValue(std::vector &v) void LottieParserImpl::getValue(VPointF &pt) { - float val[4]; + float val[4] = {0.f}; int i = 0; if (PeekType() == kArrayType) EnterArray(); while (NextArrayValue()) { - val[i++] = GetDouble(); + const auto value = GetDouble(); + if (i < 4) { + val[i++] = value; + } } pt.setX(val[0]); pt.setY(val[1]); @@ -1739,12 +1742,15 @@ void LottieParserImpl::getValue(float &val) void LottieParserImpl::getValue(LottieColor &color) { - float val[4]; + float val[4] = {0.f}; int i = 0; if (PeekType() == kArrayType) EnterArray(); while (NextArrayValue()) { - val[i++] = GetDouble(); + const auto value = GetDouble(); + if (i < 4) { + val[i++] = value; + } } color.r = val[0]; color.g = val[1];