diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2025-04-07 21:06:49 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-04-14 18:59:49 +0000 |
| commit | 48959f7e5b670396805d4d62a44dd4fefac91611 (patch) | |
| tree | a41719b36da42f7b12f2bb6c264b447cbbc62342 /tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp | |
| parent | 07255301eaa288fde3d550e0119b4d3ed2c39d22 (diff) | |
QStringConverter: widen nameForEncoding()'s contract
Coverity apparently mixes bootstrap and non-bootstrap builds: it
complains that Encoding::Latin1 indexes encodingInterfaces[]
out-of-range (apparently taking the size of the latter from a
bootstrapped and the value of the former from a non-bootstrap build).
That should somehow be fixed in the Coverity configuration, but it
highlighted the fact that we have a narrow-contract function in this
security-critical class that can trivially have a wide contract, so
widen the contract by returning nullptr for invalid Encoding values.
Consequently, mark the function as noexcept.
As a drive-by, mark it also as Q_DECL_PURE_FUNCTION.
[ChangeLog][QtCore][QStringConverter] The nameForEncoding() function
now returns nullptr for an invalid Encoding value. Before, such a call
resulted in undefined behavior.
Pick-to: 6.9 6.8 6.5
Coverity-Id: 480251
Change-Id: Ie1c5c9df6881147a1ff44fe549e50748b2f5b7da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp')
0 files changed, 0 insertions, 0 deletions
