Signpost: fix an out-of-bounds read.

Occurs when dragging with RMB outside the grid to unlink a path segment.

This bug was discovered using ASan.
This commit is contained in:
Evgeny Kapun
2024-11-04 14:00:29 +00:00
committed by Simon Tatham
parent ebb50f0af2
commit 8e83f39eb9

View File

@ -2069,7 +2069,7 @@ static void draw_drag_indicator(drawing *dr, game_drawstate *ds,
int fx = FROMCOORD(ui->dx), fy = FROMCOORD(ui->dy); int fx = FROMCOORD(ui->dx), fy = FROMCOORD(ui->dy);
double ang; double ang;
if (validdrag) { if (validdrag && INGRID(state, fx, fy)) {
/* If we could move here, lock the arrow to the appropriate direction. */ /* If we could move here, lock the arrow to the appropriate direction. */
dir = ui->drag_is_from ? state->dirs[ui->sy*w+ui->sx] : state->dirs[fy*w+fx]; dir = ui->drag_is_from ? state->dirs[ui->sy*w+ui->sx] : state->dirs[fy*w+fx];