From dd57605b9ef4e12805868962efce586e57e342b6 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 8 Oct 2021 14:25:19 +0200 Subject: Http/2 - handle PADDED flag correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/network/access/http2/http2frames.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/network') 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()) -- cgit v1.2.3