summaryrefslogtreecommitdiffstats
path: root/src/gui/platform/unix/qunixnativeinterface.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-09-19 17:05:53 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-09-23 20:08:57 +0200
commitbbd1f576f70fb52187185b79636e6591cd17e9b5 (patch)
tree97c3abe287b7b4c7626d376702aa22f0b38daba3 /src/gui/platform/unix/qunixnativeinterface.cpp
parent6472616e6c98efe7b983ce2f1677dcada9c50321 (diff)
qUn/Compress: reject negative lengths
In qCompress, we've been calculating postive len values out of them, only to fail at random points later, possibly running into UB. Fail early instead. In qUncompress, we've been catching negative values, and reported them indiscriminately as "invalid data". Use a better warning message instead. By rights, nbytes ≥ 0 would be a precondition of both functions (which we would Q_ASSERT() on), but seeing we're picking this back into LTS branches, I found it prudent to use a non-fatal way to signal the precondition violation. If and when we keep these functions for Qt 7, it will be as an overload that takes QByteArrayView, in which case nbytes ≥ 0 enters as a hard precondition via the QByteArrayView constructor, so there appears to be no need to pre-program a Q_ASSERT() for Qt 7.0. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-104972 Task-number: QTBUG-106542 Change-Id: I6a1b25fe12d31e3d4c845033cad320832976f83c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/gui/platform/unix/qunixnativeinterface.cpp')
0 files changed, 0 insertions, 0 deletions