Files
nethack/sys
Ingo Paschke 146fbf20d8 Amiga: clamp amii_numcolors and guard tile CMAP loop
Reject tile/tomb IFF files whose nPlanes field exceeds DEPTH:
the CMAP loop writes 1<<np entries into amii_initmap[] /
amiv_init_map[], both sized AMII_MAXCOLORS = 1<<DEPTH = 64, so
a malformed file with nPlanes >= 7 would corrupt adjacent BSS.

After OpenScreen succeeds, clamp amii_numcolors to the actually
populated portion of the init-map arrays (AMII_PALETTE_SIZE for
text mode, AMIV_PALETTE_SIZE for tile mode).  On a 64-color
screen this stops LoadRGB4 from loading the zero-initialized
tail entries as black.  Replace the matching magic 32 in the
tilefile selection with AMIV_PALETTE_SIZE.

While there, add the (char) cast on amii_glyph_buffer's
truncating assignment to make the contract explicit.
2026-05-12 15:30:48 +02:00
..
2026-04-26 11:08:10 -04:00
2026-04-26 10:47:48 -04:00