qt6-bb10/tests/auto/corelib/tools/qlatin1string
Marc Mutz a54d44298f QLatin1String: Fix UB (nullptr passed) in relational operators
Found by UBSan:

  qstring.h:1160:44: runtime error: null pointer passed as argument 1, which is declared to never be null
  qstring.h:1160:44: runtime error: null pointer passed as argument 2, which is declared to never be null

Fix by avoiding the memcmp() calls if there's a chance that they
might be called with nullptr.

While at it, also implement !=, >, <=, >= in terms of ==, <,
and add a test, because this particular UB was not fingered by
any of the QtCore test cases, but by a Qt3D one.

Change-Id: I413792dcc8431ef14f0c79f26e89a3e9fab69465
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-09-15 10:10:28 +00:00
..
.gitignore QLatin1String: add test 2015-10-19 15:55:21 +00:00
qlatin1string.pro Use correct test to add C++14 to the project configuration 2015-12-01 15:46:31 +00:00
tst_qlatin1string.cpp QLatin1String: Fix UB (nullptr passed) in relational operators 2016-09-15 10:10:28 +00:00