QCoAP: Reject block options with the reserved SZX value


RFC 7959 §2.2 reserves SZX value 7 (which would indicate a 2048-byte
block size). createFromFrame() accepted it:
setFromDescriptiveBlockOption() computed a block size of 2048 and only
logged a warning. When such a reply also has the "more blocks" bit set,
the protocol requests the next block with that size, which reaches
blockOption() and its Q_ASSERT(!(blockSize >> 11)) which is an abort in
debug builds, and a silent mis-encoding of the size in release-builds.

Neither outcome is mandated by the spec for a client receiving a reply
as RFC 7959's requirement is for a server receiving a request.
However, but both are undesirable results from untrusted input. Reject
a Block1 or Block2 option whose SZX field (the low 3 bits of its last
byte) is 7 while parsing, so the invalid size never enters the reply.

Task-number: QTBUG-149345
Pick-to: 6.12 6.11 6.8
Change-Id: I67d2591eb44ee95a2d00fd4d8361a4d3d105cb15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
commite029fbe562faa52ecd7dd5afdefcb2840582fa3f
parente2c3cba9b55a411fb8c6dc3f2e28211c3f3f6d6f
authorMate Barany <mate.barany@qt.io>
committerMate Barany <mate.barany@qt.io>
commit timeTue, 1 Sep 2026 20:12:15 +0000