https://bugs.kde.org/show_bug.cgi?id=465518
Bug ID: 465518
Summary: Crash when loading invalid PGN file
Classification: Applications
Product: knights
Version: unspecified
Platform: Other
OS: Linux
Status: REPORTED
Severity: crash
Priority: NOR
Component: general
Assignee: alexander.se...@web.de
Reporter: cspie...@gmail.com
CC: kde-games-b...@kde.org
Target Milestone: ---
Created attachment 156112
--> https://bugs.kde.org/attachment.cgi?id=156112=edit
The invalid PGN file
Note: This is version 22.12.2, but that's not available in the versions list.
SUMMARY
When loading an invalid PGN file, Knights segfaults.
STEPS TO REPRODUCE
1. Start Knights
2. Open an invalid PGN file
OBSERVED RESULT
Crash
EXPECTED RESULT
No crash
SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15 (From KDE Git)
ADDITIONAL INFORMATION
I've attached the invalid PGN file. Since there is, apparently, only one
attachment allowed, I'll dump the gdb stack trace here:
Thread 1 "knights" received signal SIGSEGV, Segmentation fault.
0x00429f40 in Knights::Piece::pieceType (this=0x0) at
/usr/ports/ports/knights-kde/knights-22.12.2/src/core/piece.cpp:140
140 return m_type;
#0 0x00429f40 in Knights::Piece::pieceType (this=0x0) at
/usr/ports/ports/knights-kde/knights-22.12.2/src/core/piece.cpp:140
#1 0x0044bbcb in Knights::ChessRules::castlingMoves (this=0x1018160,
pos=...) at
/usr/ports/ports/knights-kde/knights-22.12.2/src/rules/chessrules.cpp:463
#2 0x004480de in Knights::ChessRules::legalMoves (this=0x1018160,
pos=...) at
/usr/ports/ports/knights-kde/knights-22.12.2/src/rules/chessrules.cpp:122
#3 0x0044cca9 in Knights::ChessRules::changeNotation (this=0x1018160,
move=0x7fffd240, notation=Knights::Move::Coordinate, color=Knights::White)
at
/usr/ports/ports/knights-kde/knights-22.12.2/src/rules/chessrules.cpp:578
#4 0x00449b05 in Knights::ChessRules::checkSpecialFlags
(this=0x1018160, move=0x7fffd240, color=Knights::White) at
/usr/ports/ports/knights-kde/knights-22.12.2/src/rules/chessrules.cpp:285
#5 0x004653a1 in Knights::Manager::processMove (this=0x4d0620
<(anonymous namespace)::Q_QGS_instance::innerFunction()::holder>, move=...)
at /usr/ports/ports/knights-kde/knights-22.12.2/src/gamemanager.cpp:736
#6 0x00465f5e in Knights::Manager::loadGameHistoryFrom (this=0x4d0620
<(anonymous namespace)::Q_QGS_instance::innerFunction()::holder>, filename=...)
at /usr/ports/ports/knights-kde/knights-22.12.2/src/gamemanager.cpp:850
#7 0x0047966a in Knights::MainWindow::protocolInitSuccesful
(this=0xaf8dd0) at
/usr/ports/ports/knights-kde/knights-22.12.2/src/knights.cpp:441
#8 0x0048045d in QtPrivate::FunctorCall,
QtPrivate::List<>, void, void (Knights::MainWindow::*)()>::call(void
(Knights::MainWindow::*)(), Knights::MainWindow*, void**) (
f=(void (Knights::MainWindow::*)(Knights::MainWindow * const)) 0x47834a
, o=0xaf8dd0, arg=0x7fffd4d0)
at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#9 0x0048001d in QtPrivate::FunctionPointer::call, void>(void
(Knights::MainWindow::*)(), Knights::MainWindow*, void**) (
f=(void (Knights::MainWindow::*)(Knights::MainWindow * const)) 0x47834a
, o=0xaf8dd0, arg=0x7fffd4d0)
at /usr/include/qt/QtCore/qobjectdefs_impl.h:185
#10 0x0047f5da in QtPrivate::QSlotObject, void>::impl(int,
QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1,
this_=0x10d8220,
r=0xaf8dd0, a=0x7fffd4d0, ret=0x0) at
/usr/include/qt/QtCore/qobjectdefs_impl.h:418
#11 0x758bf742 in ?? () from /usr/lib/libQt5Core.so.5
#12 0x0041fa0d in Knights::Manager::initComplete (this=0x4d0620
<(anonymous namespace)::Q_QGS_instance::innerFunction()::holder>)
at
/usr/ports/ports/knights-kde/knights-22.12.2/x/src/knights_autogen/EWIEGA46WW/moc_gamemanager.cpp:378
#13 0x00463e4b in Knights::Manager::protocolInitSuccesful
(this=0x4d0620 <(anonymous
namespace)::Q_QGS_instance::innerFunction()::holder>)
at /usr/ports/ports/knights-kde/knights-22.12.2/src/gamemanager.cpp:421
#14 0x004691b8 in QtPrivate::FunctorCall,
QtPrivate::List<>, void, void (Knights::Manager::*)()>::call(void
(Knights::Manager::*)(), Knights::Manager*, void**) (
f=(void (Knights::Manager::*)(Knights::Manager * const)) 0x463cc0
, o=0x4d0620 <(anonymous
namespace)::Q_QGS_instance::innerFunction()::holder>,
arg=0x1a0d778) at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#15 0x00468de9 in QtPrivate::FunctionPointer::call, void>(void
(Knights::Manager::*)(), Knights::Manager*, void**) (
f=(void (Knights::Manager::*)(Knights::Manager * const)) 0x463cc0
, o=0x4d0620 <(anonymous
namespace)::Q_QGS_instance::innerFunction()::holder>,
arg=0x1a0d778) at