qt6-bb10/tests/auto/corelib/text/qstringconverter
Marc Mutz b113b01a71 QStringConverter: harden encodingForName() against nullptr
The nameMatch() function has an implicit precondition that neither
argument is nullptr: it immediately dereferences both arguments.

Prevent the crash by checking for name == nullptr early, before
passing to nameMatch().

Add tests for null and empty.

As a drive-by, make variables in the test const (needed for the
QByteArray to avoid detaching, peer pressure for the others).

Amends a639bcda1e.

Pick-to: 6.6 6.5 6.2
Change-Id: I4a30f6c130310eb701ba7c7251168294489c34db
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-10 19:24:33 +02:00
..
CMakeLists.txt CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
euc_kr.txt Long live the ICU-based QStringConverter interface! 2022-06-19 00:41:12 +02:00
tst_qstringconverter.cpp QStringConverter: harden encodingForName() against nullptr 2023-11-10 19:24:33 +02:00