X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Frenderers%2Fsvg%2Fnanosvg%2Fnanosvg.cc;h=96435679cfb0e328cbd0d90ab9ac69122d2dff7c;hb=87b87263ddda2188a86217cca356932e36e4cd94;hp=820e61954bd12830855eb535dab30522c054ba43;hpb=c8bdaee794b69decae11a75fbfa25fb915caadd2;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvg.cc b/dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvg.cc index 820e619..9643567 100644 --- a/dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvg.cc +++ b/dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvg.cc @@ -230,13 +230,25 @@ typedef struct NSVGgradientData { char id[64]; char ref[64]; - char type; + + /** + * In the original file, using char type (without signed or unsigned) can be interpreted + * as 'unsigned char' in some build environments, like ARM architecture. + * To prevent the unexpected behavior, we replace 'char type' with 'signed char type' here. + */ + signed char type; union { NSVGlinearData linear; NSVGradialData radial; }; char spread; - char units; + + /** + * In the original file, using char type (without signed or unsigned) can be interpreted + * as 'unsigned char' in some build environments, like ARM architecture. + * To prevent the unexpected behavior, we replace 'char units' with 'signed char units' here. + */ + signed char units; float xform[6]; int nstops; NSVGgradientStop* stops; @@ -643,7 +655,12 @@ static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id) return NULL; } -static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, char* paintType) +/** + * In the original file, using char type (without signed or unsigned) can be interpreted + * as 'unsigned char' in some build environments, like ARM architecture. + * To prevent the unexpected behavior, we replace 'char paintType' with 'signed char paintType' here. + */ +static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, signed char* paintType) { NSVGattrib* attr = nsvg__getAttr(p); NSVGgradientData* data = NULL; @@ -1244,7 +1261,12 @@ static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) { NSVGcoordinate coord = {0, NSVG_UNITS_USER}; char units[32]=""; - sscanf(str, "%f%s", &coord.value, units); + + /** + * 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. + */ + sscanf(str, "%f%32s", &coord.value, units); coord.units = nsvg__parseUnits(units); return coord; }