summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2019-08-30 19:51:19 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2019-09-02 20:51:59 +0300
commit98c5f22161e25c0f6867c0bf7db7aa8d6fcf6074 (patch)
treec73cd508a5f380c1242ac21dfa657166ebaaefd7 /src/gui/image
parentdbfa374a8610948f6e03ea1b3f3bc2905ce05be0 (diff)
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>
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qiconloader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 1d0c93f26f..27c82bc09f 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -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();