From 09ab5e60d1d688cc8dc6df8e9a16c5010dd69f7e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 6 Jan 2012 13:22:13 +0100 Subject: 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 Reviewed-by: Robin Burchell --- src/network/access/qnetworkreplydataimpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/network/access/qnetworkreplydataimpl.cpp') 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, -- cgit v1.2.3