Fuzzing: Simplify figuring out the failing datetime format
Task-number: QTBUG-92275 Change-Id: I732e72e614163b536c3fa9187011c57fea639b92 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
e5d8e2ae6e
commit
c62a193ca3
@ -28,6 +28,12 @@
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
// Enable to report the currently used format, e.g. when reproducing issues
|
||||
// #define LOG_FORMAT
|
||||
#ifdef LOG_FORMAT
|
||||
#include <QDebug>
|
||||
#endif
|
||||
|
||||
static const QString formats[] = {
|
||||
QStringLiteral("h"),
|
||||
QStringLiteral("hh"),
|
||||
@ -94,6 +100,9 @@ extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size)
|
||||
QDateTime::fromString(userString, Qt::ISODateWithMs);
|
||||
|
||||
for (const auto &format : formats) {
|
||||
#ifdef LOG_FORMAT
|
||||
qDebug() << "Trying format:" << format;
|
||||
#endif
|
||||
QDateTime::fromString(userString, format);
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user