shithub: puzzles

Download patch

ref: 21193eaf9308ace41004a19180ff382ec6e8754b
parent: b3d4a4197954c21ac78b68c58dff8f84fe743ea2
author: Ben Harris <bjh21@bjh21.me.uk>
date: Thu Jan 12 15:55:56 EST 2023

Palisade: forbid moves that remove grid edges

Without this check, a corrupt save file can include a move that
removes an edge of the grid, and then is_solved() walks off the edge
of the grid causing a buffer over- or under-run.

To demonstrate the bug, load this save file in a build with
AddressSanitizer:

SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
VERSION :1:1
GAME    :8:Palisade
PARAMS  :5:5x5n5
CPARAMS :5:5x5n5
DESC    :0:
NSTATES :1:2
STATEPOS:1:2
MOVE    :6:F0,0,1