daylen / stockfish-mac

Beautiful, powerful chess app for the Mac
http://stockfishchess.org/mac/
GNU General Public License v3.0
511 stars 116 forks source link

Repeatable GUI crash with this FEN when analysis starts #52

Open gmofishsauce opened 6 years ago

gmofishsauce commented 6 years ago

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

gmofishsauce commented 6 years ago

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
ewanmellor commented 6 years ago

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.