diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-11-29 10:43:42 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-11-30 09:09:55 +0000 |
commit | 137d02678e017ab94f83732c0f72927c7d46cd90 (patch) | |
tree | 655655b80f9c1e6162c63704c24202fc794022f8 /src/libs/qmldebug | |
parent | 3d92a79a096d5777f8dce6712b875ef7d9e339ee (diff) |
QML Debugger: Guard against some invalid data
If the debug service announced unreasonably large numbers of objects and
contexts, we would fill an unreasonable amount of memory with junk here.
Change-Id: I461d378f35c7b87ee0be1b5a09aed3d27a133343
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/qmldebug')
-rw-r--r-- | src/libs/qmldebug/baseenginedebugclient.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/qmldebug/baseenginedebugclient.cpp b/src/libs/qmldebug/baseenginedebugclient.cpp index df014e43a0..7f8c64f151 100644 --- a/src/libs/qmldebug/baseenginedebugclient.cpp +++ b/src/libs/qmldebug/baseenginedebugclient.cpp @@ -155,7 +155,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds, int contextCount; ds >> contextCount; - for (int ii = 0; ii < contextCount; ++ii) { + for (int ii = 0; ii < contextCount && !ds.atEnd(); ++ii) { c.m_contexts.append(ContextReference()); decode(ds, c.m_contexts.last()); } @@ -163,7 +163,7 @@ void BaseEngineDebugClient::decode(QDataStream &ds, int objectCount; ds >> objectCount; - for (int ii = 0; ii < objectCount; ++ii) { + for (int ii = 0; ii < objectCount && !ds.atEnd(); ++ii) { ObjectReference obj; decode(ds, obj, true); obj.m_contextDebugId = c.m_debugId; |