diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-10-08 14:25:19 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-10-09 12:49:01 +0200 |
commit | dd57605b9ef4e12805868962efce586e57e342b6 (patch) | |
tree | 7e8ce26856d61b0179b956e8245da74c423dd6ac /src/network | |
parent | 5d4b91ea66666f3c8d3c8640b87a33c13dbd0c2c (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).
Pick-to: 6.2 5.15
Fixes: QTBUG-97179
Change-Id: I9341a4d68510aa4c26f4972afdcd09a530d5a367
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/http2/http2frames.cpp | 5 |
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()) |