Contents of /trunk/qt4/patches/qt-4.8.5-qtbug-32534.patch
Parent Directory | Revision Log
Revision 2278 -
(show annotations)
(download)
Tue Sep 3 07:33:26 2013 UTC (11 years ago) by niro
File size: 1837 byte(s)
Tue Sep 3 07:33:26 2013 UTC (11 years ago) by niro
File size: 1837 byte(s)
-upstream fixes for 4.8.5
1 | From 1f40ed553e618c3b0511c7db4b4fd26c2d2b65bf Mon Sep 17 00:00:00 2001 |
2 | From: Peter Hartmann <phartmann@blackberry.com> |
3 | Date: Thu, 25 Jul 2013 12:05:29 -0400 |
4 | Subject: [PATCH] QHttpMultiPart: fix data corruption in readData method |
5 | |
6 | When readData() is called repeatedly, we need to keep track which |
7 | part of the multipart message we are currently reading from. |
8 | Hereby we also need to take the boundary size into account, and not |
9 | only the size of the multipart; otherwise we would skip a not |
10 | completely read part. This would then later lead to advancing the |
11 | read pointer by negative indexes and data loss. |
12 | |
13 | Task-number: QTBUG-32534 |
14 | Change-Id: Ibb6dff16adaf4ea67181d23d1d0c8459e33a0ed0 |
15 | Reviewed-by: Jonathan Liu <net147@gmail.com> |
16 | Reviewed-by: Shane Kearns <shane.kearns@accenture.com> |
17 | (cherry picked from qtbase/af96c6fed931564c95037539f07e9c8e33c69529) |
18 | Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> |
19 | --- |
20 | src/network/access/qhttpmultipart.cpp | 3 +- |
21 | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 44 ++++++++++++++++++++++++ |
22 | 2 files changed, 46 insertions(+), 1 deletions(-) |
23 | |
24 | diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp |
25 | index 635129a..b25e917 100644 |
26 | --- a/src/network/access/qhttpmultipart.cpp |
27 | +++ b/src/network/access/qhttpmultipart.cpp |
28 | @@ -488,7 +488,8 @@ qint64 QHttpMultiPartIODevice::readData(char *data, qint64 maxSize) |
29 | |
30 | // skip the parts we have already read |
31 | while (index < multiPart->parts.count() && |
32 | - readPointer >= partOffsets.at(index) + multiPart->parts.at(index).d->size()) |
33 | + readPointer >= partOffsets.at(index) + multiPart->parts.at(index).d->size() |
34 | + + multiPart->boundary.count() + 6) // 6 == 2 boundary dashes, \r\n after boundary, \r\n after multipart |
35 | index++; |
36 | |
37 | // read the data |
38 | -- |
39 | 1.7.1 |
40 |