From b85d6752041b0b00480e8c2ddaed88696cdb21c5 Mon Sep 17 00:00:00 2001 From: "taeyoon0.lee" Date: Tue, 16 May 2017 20:37:37 +0900 Subject: [PATCH] [Tizen] Fix SVACE issue - change sscanf(%d) to strtol This reverts commit a6bfb5a20c362b143e05c81dc662a4ecd717f179. Change-Id: I11447bd763049e27e7ec1b424cf80678a3f35805 --- dali-toolkit/third-party/nanosvg/nanosvg.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dali-toolkit/third-party/nanosvg/nanosvg.cc b/dali-toolkit/third-party/nanosvg/nanosvg.cc index d3ffc40..601413c 100644 --- a/dali-toolkit/third-party/nanosvg/nanosvg.cc +++ b/dali-toolkit/third-party/nanosvg/nanosvg.cc @@ -1038,9 +1038,15 @@ static unsigned int nsvg__parseColorRGB(const char* str) /** * In the original file, the formatted data reading did not specify the string with width limitation. - * To prevent the possible overflow, we replace '%s' with '%32s' here. + * To prevent the possible overflow, we replace '%s' with '%31s' and use strtol here */ - sscanf(str + 4, "%d%32[%%, \t]%d%32[%%, \t]%d", &r, s1, &g, s2, &b); + char* end; + r = strtol(str + 4, &end, 10); + sscanf(end, "%31[%%, \t]", s1); + g = strtol(end + strlen(s1), &end, 10); + sscanf(end, "%31[%%, \t]", s2); + b = strtol(end + strlen(s2), &end, 10); + if (strchr(s1, '%')) { return NSVG_RGB((r*255)/100,(g*255)/100,(b*255)/100); } else { @@ -1269,9 +1275,9 @@ static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) /** * In the original file, the formatted data reading did not specify the string with width limitation. - * To prevent the possible overflow, we replace '%s' with '%32s' here. + * To prevent the possible overflow, we replace '%s' with '%31s' here. */ - sscanf(str, "%f%32s", &coord.value, units); + sscanf(str, "%f%31s", &coord.value, units); coord.units = nsvg__parseUnits(units); return coord; } -- 2.7.4