summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-26 09:24:58 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-26 09:24:58 (EDT)
commitbc8de0954b04eab4aa3b810fb5913b0500aae923 (patch)
tree35c7eaa60d318149479044daa5c0678dc8d459ec
parent8dd7067fdb3a56506984f46effa3d6e29f9ba984 (diff)
downloaddodge-balls-bc8de0954b04eab4aa3b810fb5913b0500aae923.zip
dodge-balls-bc8de0954b04eab4aa3b810fb5913b0500aae923.tar.gz
dodge-balls-bc8de0954b04eab4aa3b810fb5913b0500aae923.tar.bz2
tileset: Ensure there are no more than 32 tiles
-rw-r--r--src/tileset.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tileset.c b/src/tileset.c
index f1b7e36..d8b3c03 100644
--- a/src/tileset.c
+++ b/src/tileset.c
@@ -312,6 +312,11 @@ _db_tsx_tileset_start(void *pv, const char *name, const char **attr)
return;
}
db_xml_get_int_attr(p, attr, "tilecount", &tileset->tc, 1);
+ if (tileset->tc > 32) {
+ db_err("Tileset may not have more than 32 tiles");
+ XML_StopParser(p, XML_FALSE);
+ return;
+ }
db_xml_get_int_attr(p, attr, "columns", &tileset->cols, 1);
db_dbg(" Tile size: %dx%d px",
tileset->tw, tileset->th);