Browse Source

[c] Error in color parsing, off-by-one resulting in invalid memory access. Closes #1031. Thanks @minggo for the adress sanitizer hint.

badlogic 7 years ago
parent
commit
361378b275
1 changed files with 2 additions and 1 deletions
  1. 2 1
      spine-c/spine-c/src/spine/SkeletonJson.c

+ 2 - 1
spine-c/spine-c/src/spine/SkeletonJson.c

@@ -93,7 +93,8 @@ static float toColor (const char* value, int index) {
 	char *error;
 	int color;
 
-	if (strlen(value) / 2 < index) return -1;
+	if (index >= strlen(value) / 2)
+		return -1;
 	value += index * 2;
 
 	digits[0] = *value;