Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
None
-
5.15.1
-
None
-
-
101581484bd278ce4a5f329ffb13c9e0b0e4c131 (qt/qtbase/dev)
Description
The QCommandLineParser class seems to have a strange relation to QCoreApplication. It provides an interface, through which the command line parameters can be parsed, which makes it possible to use it BEFORE a QCoreApplication is created. However calling one of the helpText/showHelp function crashes the application, since an array emptiness check is missing at the line:
https://code.woboq.org/qt5/qtbase/src/corelib/tools/qcommandlineparser.cpp.html#1126
which brings us to the question: if I provide every information about command line argument parsing for an object of this class, why is the QCoreApplication needed? Isn't everything already stored in the QCommandLineParser object itself? Is it not possible to only print the QCoreApplication-dependent information optionally, if the QCoreApplication exists?
Anyway, at least returning an empty string an setting the error accordingly is expected instead of crashing.