Fix crashing data urls
Commit 231369eb04
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>
This commit is contained in:
parent
b44c6bef50
commit
09ab5e60d1
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user