From ccdd18ed4c9ca090ead3c1ac844b621fdaa51984 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 20 Jan 2016 21:30:51 +0100 Subject: [PATCH] Fix crash on pasting garbage FEN The auto-size patch had made XBoard crash-prone on pasting pure garbage with Paste Position, because this would set the number of files or ranks to values <= 0. Which would cause a floating pont exception during drawing of the board in XBoard. --- backend.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend.c b/backend.c index 174b2a2..d362be5 100644 --- a/backend.c +++ b/backend.c @@ -18148,7 +18148,7 @@ ParseFEN (Board board, int *blackPlaysFirst, char *fen, Boolean autoSize) while (emptycount--) board[i][(j++)+gameInfo.holdingsWidth] = EmptySquare; if (*p == '/') p++; - else if(autoSize) { // we stumbled unexpectedly into end of board + else if(autoSize && i != BOARD_HEIGHT-1) { // we stumbled unexpectedly into end of board for(k=i; k