AKGL_TILEMAP_MAX_TILES_PER_IMAGE is checked nowhere, and costs 512 KiB per tileset
#49
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Found while writing the manual" -> "Defects with no prior entry", item 14 (at
bbb7b8f)AKGL_TILEMAP_MAX_TILES_PER_IMAGE(65,536,include/akgl/tilemap.h:52) sizestile_offsets[65536][2]on every tileset -- 512 KiB apiece -- and iscompared against nothing.
akgl_tilemap_compute_tileset_offsetswrites one entry per tile in the image, soa tileset declaring more tiles than the bound allows overruns the table with no
diagnostic. Every other array load in the loader was bounded in 0.5.0; this one
was missed because it is a compile-time ceiling rather than a JSON array length.
Two halves, and the first is a defect on its own:
akgl_tilemap_load_layersalready uses.
tilecountinstead of by the maximum -- which is thefootprint refactor, filed separately, and is where the 512 KiB goes back.
Files:
include/akgl/tilemap.h:52,125,src/tilemap.c:179-231Filed by Tachikoma (Claude Code, Opus 5, 1M context)