Bug 424263 - Golf with Black Hole Solver crashes when dealing last card from the deck
Summary: Golf with Black Hole Solver crashes when dealing last card from the deck
Status: RESOLVED FIXED
Alias: None
Product: kpat
Classification: Applications
Component: solver (show other bugs)
Version: 22.11.90
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
: 465032 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-07-15 21:45 UTC by Maciej Stanczew
Modified: 2023-01-30 11:52 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 22.12.1
Sentry Crash Report:


Attachments
Ensure space after "Talon:" entry (656 bytes, patch)
2020-07-15 21:45 UTC, Maciej Stanczew
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stanczew 2020-07-15 21:45:11 UTC
Created attachment 130151 [details]
Ensure space after "Talon:" entry

SUMMARY
Using Black Hole Solver, sometimes when dealing the last card from the deck the game will crash. This happens when BH solver is called on the last card (i.e. when the game is not lost). It can also be triggered by doing an Undo and replaying the last card from the deck.

STEPS TO REPRODUCE
1. Start a game of Golf
2. Deal all cards from the deck
3. Undo the last move (one card back to the deck)
4. Deal last card from the deck

OBSERVED RESULT
The application crashes with message "Error reading the board at line No. 2!".

EXPECTED RESULT
Same behavior as in step #2 -- no crash, solver reporting "This game is lost".

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.19.3
KDE Frameworks Version: 5.72.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
This error is returned from Black Hole Solver because of missing space in board description. When there are no cards in the deck, Golf will produce a line "Talon:", but BH Solver expects there to always be a space after the colon, like in "Talon: ".
I have attached a patch that should solve the issue.

Also, about being able to reproduce it with the Undo button: this could be related to bug 424261. When reaching "This game is lost" state while there are still cards in the deck, BH Solver will no longer be called, so we will not encounter the missing space issue. However after doing an Undo and replaying the last move BH Solver is called again, leading to the crash.
Comment 1 Justin Zobel 2022-12-01 05:21:57 UTC
Thank you for reporting this issue in KDE software. As it was reported on an older version, can we please ask you to see if you can reproduce the issue with a more recent software version?  
  
If you can confirm this issue still exists in a recent version, please change the version field and the status to "REPORTED" when replying. Thank you!
Comment 2 Maciej Stanczew 2022-12-02 20:07:06 UTC
Sure, I can still reproduce the issue in exactly the same way on both 22.08.3 and 22.11.90.
Comment 3 Bug Janitor Service 2022-12-02 22:29:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/games/kpat/-/merge_requests/32
Comment 4 Albert Astals Cid 2022-12-02 22:33:19 UTC
Git commit c4bb5993cb34a80867a5ddfdfa8aabad249f63f2 by Albert Astals Cid, on behalf of Maciej Stanczew.
Committed on 02/12/2022 at 22:28.
Pushed by aacid into branch 'release/22.12'.

Fix crash when dealing last card from the deck

M  +4    -2    src/golf.cpp

https://invent.kde.org/games/kpat/commit/c4bb5993cb34a80867a5ddfdfa8aabad249f63f2
Comment 5 Stephan Kulow 2023-01-30 11:52:35 UTC
*** Bug 465032 has been marked as a duplicate of this bug. ***