daylen/stockfish-mac

Repeatable GUI crash with this FEN when analysis starts

gmofishsauce opened this issue · 2 comments

Version: 2.1.2 (24)
Platform: macOS Sierra (10.12.6). Stock 4GB 13" non-retina mid-2012 Mac Pro.
Issue: GUI crashes when analysis starts
To reproduce:

Copy the FEN to clipboard: r6k1/p1p2ppp/5b2/3R4/6rP/2P2N1R/PPP2P2/1K6 w - - 1 21
Open a new Stockfish window
Edit:Paste FEN
Press Cmd-+ 4 times to spin up a total of 5 analysis lines
Press Go button at upper right
GUI disappears

Minidump attached

minidump.txt

Also, FYI which binary is running on this host:

$ ps -efww | grep fish
  501 88808     1   0  4:01PM ??         0:00.95 /Applications/Stockfish.app/Contents/MacOS/Stockfish
  501 88811 88808   0  4:01PM ??         0:01.02 /Applications/Stockfish.app/Contents/Resources/stockfish-sse42
  501 88818 86322   0  4:01PM ttys000    0:00.01 grep fish

The given FEN is invalid. "r6k1" at the start is 9 squares. This is passed to Stockfish, which then proposes an illegal move, and we hit an assert inside Position::do_move.

Changing the FEN to read "r6k" at the start avoids the crash.

This shouldn't crash of course; this FEN should have been flagged as invalid by Position::is_valid_fen but that code doesn't check that the number of squares in a rank is correct.