summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2021-10-08 14:25:19 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2021-10-11 15:25:12 +0200
commit8bb47a4adee0110acec5cc52611a25142e644dda (patch)
tree6263ddcda8f125c951b2919b6ee64db13e8ef8e8 /src
parentf761ea71d10a0a0df85fa3abc1f810fe3bd59131 (diff)
Http/2 - handle PADDED flag correctly
Previously, when deciding where the actual data is, Frame was calling padding() to test if offset is needed. A curious case with a DATA frame containing compressed body and having 'PADDED' flag set with a padding equal to ... 0, ended in a decompression error (and assert in 6.2 code). Fixes: QTBUG-97179 Change-Id: I9341a4d68510aa4c26f4972afdcd09a530d5a367 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit dd57605b9ef4e12805868962efce586e57e342b6) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/network/access/http2/http2frames.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/access/http2/http2frames.cpp b/src/network/access/http2/http2frames.cpp
index ce33505683..f1f2cdf8f4 100644
--- a/src/network/access/http2/http2frames.cpp
+++ b/src/network/access/http2/http2frames.cpp
@@ -233,7 +233,8 @@ quint32 Frame::dataSize() const
Q_ASSERT(validatePayload() == FrameStatus::goodFrame);
quint32 size = payloadSize();
- if (const uchar pad = padding()) {
+ if (flags().testFlag(FrameFlag::PADDED)) {
+ const uchar pad = padding();
// + 1 one for a byte with padding number itself:
size -= pad + 1;
}
@@ -269,7 +270,7 @@ const uchar *Frame::dataBegin() const
return nullptr;
const uchar *src = &buffer[0] + frameHeaderSize;
- if (padding())
+ if (flags().testFlag(FrameFlag::PADDED))
++src;
if (priority())