From 8b18cc58c8a9f37fb44bdacbee97c4ea78872bfd Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 1 Sep 2019 12:03:18 +0300 Subject: [PATCH] Fix possible out of bounds reading. Asserts could be disabled in the Release build. --- src/lottie/lottieparser.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lottie/lottieparser.cpp b/src/lottie/lottieparser.cpp index 85696b7..622cf2b 100644 --- a/src/lottie/lottieparser.cpp +++ b/src/lottie/lottieparser.cpp @@ -771,10 +771,7 @@ LottieColor LottieParserImpl::toColor(const char *str) // some resource has empty color string // return a default color for those cases. - if (!len) return color; - - RAPIDJSON_ASSERT(len == 7); - RAPIDJSON_ASSERT(str[0] == '#'); + if (len != 7 || str[0] != '#') return color; char tmp[3] = {'\0', '\0', '\0'}; tmp[0] = str[1]; -- 2.34.1