qt5base-lts/tests/auto/corelib/tools/qdatetime
Edward Welbourne c066656aff Avoid read-outside-array error by QStringRef over-reach
Constructing a QStringRef directly from the string, offset and a
length is UB if the offset + length exceeds the string's length.
Thanks to Robert Loehning and libFuzzer for finding this.
QString::midRef (as correctly used in both changed uses of QStringRef,
since 432d3b6962) takes care of that for us.  Changed one UB case and
a matching but correct case, for consistency.

In the process, deduplicate a QStringList look-up.
Added tests to exercise the code (but the one that exercises the
formerly UB case doesn't crash before the fix, so isn't very useful;
the invalid read is only outside the array it's scanning, not outside
allocated memory).

Change-Id: I7051bbbc0267dd7ec0a8f75eee2034d0b7eb75a2
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-02-08 13:56:25 +00:00
..
.gitignore Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
BLACKLIST Blacklist two tests on macOS that a planned CI change shall break 2018-08-24 17:30:01 +00:00
qdatetime.pro Use msvc qmake scope where appropriate 2018-11-22 14:16:52 +00:00
tst_qdatetime_mac.mm Round to nearest millisecond in QDateTime::fromCFDate() 2016-10-02 13:07:18 +00:00
tst_qdatetime.cpp Avoid read-outside-array error by QStringRef over-reach 2019-02-08 13:56:25 +00:00