diff options
author | Sami Rosendahl <sami.rosendahl@reaktor.fi> | 2011-11-11 12:29:38 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2011-11-11 12:29:38 (GMT) |
commit | 371617983a7640a42d74db9c17f7ac3c9c22d29d (patch) | |
tree | 602885203f1f974f1c2eb519b570ec4cb2b74d58 /src | |
parent | 425272e7405eed077cb65a101d5dd1fafc4b11d2 (diff) | |
download | Qt-371617983a7640a42d74db9c17f7ac3c9c22d29d.zip Qt-371617983a7640a42d74db9c17f7ac3c9c22d29d.tar.gz Qt-371617983a7640a42d74db9c17f7ac3c9c22d29d.tar.bz2 |
Fix crash in QHttpNetworkReplyPrivate::gunzipBodyPartiallyEnd
If a HTTP server responds with gzip-encoded empty content without defining
Content-Length in the response header QHttpNetworkReplyPrivate::gunzipBodyPartiallyEnd
will crash because it calls zlib inflateEnd for an uninitialized stream.
- Fixed the crash by adding a check if the stream is initialized to gunzipBodyPartiallyEnd.
- Added a regression test tst_QNetworkReply::nb279420gzipNoContentLengthEmptyContentDisconnect
PMO 279420
Task-number: QTBUG-22660
Signed-off-by: Sami Rosendahl <sami.rosendahl@reaktor.fi>
Merge-request: 1465
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qhttpnetworkreply.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 6173b39..3dc8b2f 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -472,8 +472,10 @@ int QHttpNetworkReplyPrivate::gunzipBodyPartially(QByteArray &compressed, QByteA void QHttpNetworkReplyPrivate::gunzipBodyPartiallyEnd() { - inflateEnd(&inflateStrm); - initInflate = false; + if (initInflate) { + inflateEnd(&inflateStrm); + initInflate = false; + } } #endif |