Avoid invalid memory access in QIconCacheGtkReader::lookup()

If name argument is empty, e.g. an icon is created by
QIcon::fromTheme(""), then icon_name_hash() will access
a byte at index 1, which is outside of the string.

Change-Id: I109c476718939d7dd252007ebac48c3dbbeceb72
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
bb10
Alexander Volkov 2019-08-30 19:51:19 +03:00
parent dbfa374a86
commit 98c5f22161
1 changed files with 1 additions and 1 deletions

View File

@ -281,7 +281,7 @@ static quint32 icon_name_hash(const char *p)
QVector<const char *> QIconCacheGtkReader::lookup(const QStringRef &name)
{
QVector<const char *> ret;
if (!isValid())
if (!isValid() || name.isEmpty())
return ret;
QByteArray nameUtf8 = name.toUtf8();