summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-01-06 13:22:13 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-06 13:41:46 +0100
commit09ab5e60d1d688cc8dc6df8e9a16c5010dd69f7e (patch)
treecd22ad5ba4ecfe1ad6bfc3c1d367c25665dfbe56 /src/network
parentb44c6bef5041359ac2387379c80f55549d562d8c (diff)
Fix crashing data urls
Commit 231369eb043e9c5221da1a4f2a724643a3f380f3 introduced the use of QBuffer::setBuffer with a QByteArray that is allocated on the stack, causing plenty of memory corruption. This patch replaces the use of setBuffer with setData, which correctly assigns the QBuffer's buffer instead of just relying on the pointer passed to setBuffer. Spotted by Rohan in http://codereview.qt-project.org/#change,11859 Change-Id: I7cdf43d438a2a7864de7c35841b42421c1c60e68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkreplydataimpl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/access/qnetworkreplydataimpl.cpp b/src/network/access/qnetworkreplydataimpl.cpp
index 1c12eadd6c..22f40b2420 100644
--- a/src/network/access/qnetworkreplydataimpl.cpp
+++ b/src/network/access/qnetworkreplydataimpl.cpp
@@ -78,7 +78,7 @@ QNetworkReplyDataImpl::QNetworkReplyDataImpl(QObject *parent, const QNetworkRequ
setHeader(QNetworkRequest::ContentLengthHeader, size);
QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
- d->decodedData.setBuffer(&payload);
+ d->decodedData.setData(payload);
d->decodedData.open(QIODevice::ReadOnly);
QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection,