Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
6.2.0
-
None
-
macOS 12.0.1
-
-
97cba363f99bec3174e305a714d4cdcabb147838 (qt/qtbase/6.2)
Description
In self-built Qt 6.2 on macOS I get a crash on a line:
QDateTime::fromString("200507065922Z", "yyMMddHHmmsst")
The assertion is this:
Q_ASSERT(([data](qint64 offset) { return offset == data.offsetFromUtc // When zoneMSecs falls in a spring-forward's gap: || offset == data.standardTimeOffset // When it falls in the gap leading into double-DST: || offset == 2 * data.standardTimeOffset // When it falls in a skipped day (Pacific date-line crossings): || (data.offsetFromUtc - offset) % SECS_PER_DAY == 0; })((zoneMSecs - data.atMSecsSinceEpoch) / MSECS_PER_SEC));
It shows such fields:
- zoneMSecs = -1577923200000
- data.atMSecsSinceEpoch = -1577937600000
- data.offsetFromUtc = 13272
- data.standardTimeOffset = 13272
- data.daylightTimeOffset = 0
This happens when reading information about X509 certificate, in:
- X509CertificateGeneric::parse
- QAsn1Element::toDateTime
When reading notValidBefore and notValidAfter.
Also, this code works in Qt 5.15.2 (because there is no such assert), but it produces a date with year 1920 in both Qt 5.15.2 and Qt 6.2 (if I comment out this assertion).
I think this is invalid date being parsed, because UTCTime in this format should parse to 2020 year, not 1920.