diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2024-07-18 14:36:52 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-07-20 20:56:17 +0000 |
| commit | 6d3bd0ebeacc76178fc3c4c368e04bd642881a96 (patch) | |
| tree | 4220eef42c235a58d3fd0eed19896750bdf87ab8 /src/corelib/io/qdebug.cpp | |
| parent | 4c5b437a3ce84354dfa3bf2c4706e05144ac03a3 (diff) | |
Fix potential truncation in write_xbm_image()
The old code sized the buffer according to the UTF-16 size of the
input, but in fact wrote UTF-8 output, which can be up to twice as
large as UTF-16, overflowing the buffer size. Not a buffer overflow,
because qs_n_printf(), but truncation would create an invalid XBM
file here.
Fix by converting to UTF-8 first (and only once), and taking the
buffer size from there.
Introduced by 2883a6de408c991ecf6184d7216c7d3de6fa4f4f, which replaced
toAscii() (whose result has the same size as the input) with toUtf8()
(which can be larger).
Pick-to: 6.8 6.7 6.5
Change-Id: I4acc0816a94060520695c3e6895ed982812fdee2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
0 files changed, 0 insertions, 0 deletions
