QHttp2Connection: fix potential streamId reuse

Change-Id: Ib81058c4613820f15f55388b87433875c11492dd
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit df4322f7f7dc818c5dd1dd859ce5010116d5d651)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2024-02-16 13:15:11 +01:00 committed by Qt Cherry-pick Bot
parent 4f92e8fe50
commit cd307451ae

View File

@ -559,8 +559,9 @@ QHttp2Connection::createStreamInternal()
QHttp2Stream *QHttp2Connection::createStreamInternal_impl(quint32 streamID) QHttp2Stream *QHttp2Connection::createStreamInternal_impl(quint32 streamID)
{ {
qsizetype numStreams = m_streams.size();
QPointer<QHttp2Stream> &stream = m_streams[streamID]; QPointer<QHttp2Stream> &stream = m_streams[streamID];
if (stream) if (numStreams == m_streams.size()) // stream already existed
return nullptr; return nullptr;
stream = new QHttp2Stream(this, streamID); stream = new QHttp2Stream(this, streamID);
stream->m_recvWindow = streamInitialReceiveWindowSize; stream->m_recvWindow = streamInitialReceiveWindowSize;