9f5a687ffe
The only user of the function, QCollatorPrivate::init(), passes QLocalePrivate::bcp47Name().constData(). bcp47Name() may return a default-constructed QByteArray (e.g. for QLocale::AnyLanguage), so constData() may be nullptr (QT5_NULL_STRINGS != 1). Passing nullptr to strncmp() or strncpy() is UB, though. Instead of using the nullptr-hardened q... versions of these functions, check name for nullptr once, at the top of the function, and avoid all the lookup code that follows and is known to fail (because windows_to_iso_list does not contain empty entries). This way, we take advantage of the std functions' UB for performance reasons (fewer repeated nullptr checks), instead of being taken advantage of. Qt 5 is not affected, as constData() never returns nullptr there. Pick-to: 6.5 6.4 6.2 Change-Id: I980dace2bca1e983ac526e89fadeb92239ab5f11 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake | ||
sync.profile |