Skip to content

Commit

Permalink
Fuzzing: Test different calendar systems
Browse files Browse the repository at this point in the history
Change-Id: I61be9f09d4299674e9cf9daf1d4dbbf90f3d2d2d
Reviewed-by: Edward Welbourne <[email protected]>
  • Loading branch information
rlohning committed Apr 26, 2021
1 parent 6a3cc36 commit 7acce0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/libfuzzer/corelib/time/qdatetime/fromstring/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#endif

static const QString formats[] = {
QStringLiteral("M/d/yyyy"),
QStringLiteral("h"),
QStringLiteral("hh"),
QStringLiteral("H"),
Expand All @@ -47,7 +48,6 @@ static const QString formats[] = {
QStringLiteral("zzz"),
QStringLiteral("A"),
QStringLiteral("t"),
QStringLiteral("M/d/yyyy"),
QStringLiteral("M/d/yyyy hh:mm"),
QStringLiteral("M/d/yyyy hh:mm A"),
QStringLiteral("M/d/yyyy, hh:mm"),
Expand Down Expand Up @@ -99,6 +99,10 @@ extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size)
QDateTime::fromString(userString, Qt::RFC2822Date);
QDateTime::fromString(userString, Qt::ISODateWithMs);

QDateTime::fromString(userString, formats[0], QCalendar(QCalendar::System::Gregorian));
for (int sys = int(QCalendar::System::Julian); sys <= int(QCalendar::System::Last); ++sys)
QDateTime::fromString(userString, formats[0], QCalendar(sys));

for (const auto &format : formats) {
#ifdef LOG_FORMAT
qDebug() << "Trying format:" << format;
Expand Down

0 comments on commit 7acce0c

Please sign in to comment.