From 1bdcd4ada14e749b226b94b64608c41beaaecd66 Mon Sep 17 00:00:00 2001 From: alex-eg Date: Sat, 21 Nov 2026 14:56:22 +0300 Subject: [PATCH] make tmx.sex handle infinite maps gracefully --- tmx.sex | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tmx.sex b/tmx.sex index cf36885..52ea7e6 100644 --- a/tmx.sex +++ b/tmx.sex @@ -71,6 +71,25 @@ (tile-height int))) (pub fn load-tmx ((file (* const char))) (* tmx-map) + ;; raytmx does not support Tiled infinite maps: their data makes + ;; its CSV parser read past a fixed-size stack buffer. Reject them with a + ;; useful message instead of crashing inside the parser. + (var raw (* char) (LoadFileText file)) + (if (== raw NULL) + (do + (TraceLog LOG-ERROR "failed to read TMX \"%s\"" file) + (return NULL))) + (var is-infinite (* char) (strstr raw "infinite=\"1\"")) + (var has-chunks (* char) (strstr raw "