summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-08-17 02:50:23 +0200
committerkdx <kikoodx@paranoici.org>2023-08-17 03:03:54 +0200
commitada8e5fd4a6315bf3e6368862477353b1d13c3bb (patch)
tree1806ed4df5373d2c488b7f1f2d3732c1384a6273
parentaf96c12cec84d1c78f8a641463a842f0ed3004d2 (diff)
downloadtiled2c-ada8e5fd4a6315bf3e6368862477353b1d13c3bb.tar.gz
prevent invisible overflow bug
cJSON caps int to their largest value, tiled uses unsigned int that can go up to the uppest limit. using the 32 bits causes an overflow when converting a 32 bit unsigned inter to a 32 bit integer... you guess the rest
-rw-r--r--src/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index c8c4d82..9c55ef2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -69,7 +69,7 @@ process_tilelayer(cJSON *json)
printf(".tilelayer={(const unsigned int[]){");
cJSON *tile;
cJSON_ArrayForEach(tile, data)
- printf("%u,", tile->valueint);
+ printf("%u,", (unsigned)tile->valuedouble);
printf("}}},");
return 0;