Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Fixed

- Maze levels (the bottom of the dungeon): `makemaz()` overflowed its fixed `int stack[200]` on about 7% of seeds (stack smashing / SIGABRT, or silent corruption). The maze grid has 8×37 = 296 cells, each pushed at most once, so the stack is now sized `8*37+1`. Maze output is byte-identical for every seed that didn't overflow.
- Linux ARM64 (and any unsigned-`char` ABI): `mklev` crashed with SIGFPE/SIGSEGV on every normal level because Jay's `croom->hx = -1` end-of-rooms sentinel became 255. The build now passes `-fsigned-char`, matching the PDP-11's signed `char`. Same bug class as restoHack #15.
- After the "TERMINAL TOO SMALL" screen, the map wasn't redrawn if the terminal went back to the same size it had before the shrink (`check_resize()` only redrew on a size change), so the warning stayed on screen. It now always redraws after that screen.
- Fixed a segfault on Ctrl-R (repeat last message) when there was no previous message: the 1982 `pline(0)` path fell through to `index(NULL,'%')`. Both the normal and SMALL builds now print "No message.". (#11)
Expand Down
10 changes: 10 additions & 0 deletions src/root/mklev.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,17 @@ void makemaz(void)
int x,y,a,q,sp;
int dir,dirs[5];
register int zx,zy;
#if 0
int stack[200];
#endif
/* Modern: size the DFS stack for the worst case. Maze cells sit at odd
* coordinates, 8 rows (3..17, see MAZY) by 37 columns (3..75, see MAZX),
* so 296 cells. Each cell is pushed at most once (it is marked typ=2 as
* soon as it reaches the top), and stack[0] is never used, so the deepest
* path needs 8*37+1 entries. With 200, about 7% of maze levels ran past
* the end of the array (measured: depth 90-232 over 3000 seeds) and
* corrupted the stack. */
int stack[8*37+1];
struct obj *otmp;

for(x=2; x<19; x++)
Expand Down
Loading