Go to file
Marc Mutz 7908b0cea6 QFontEngine: fix GCC 12 -Werror=array-bounds
Says GCC 12 with -sanitize address -sanitize undefined:

    qfontengine.cpp: In member function ‘bool QFontEngine::processHheaTable() const’:
    qfontengine.cpp:386:65: error: array subscript 4 is outside array bounds of ‘const char [1]’ [-Werror=array-bounds]
      386 |         qint16 ascent = qFromBigEndian<qint16>(hhea.constData() + 4);
          |                                                ~~~~~~~~~~~~~~~~~^~~
    qbytearray.h:56:23: note: at offset 4 into object ‘QByteArray::_empty’ of size 1
       56 |     static const char _empty;
          |                       ^~~~~~

(repeats several times)

The compiler apparently assumes that data() and size() are independent
of each other, and so finds that that constData() may return &_empty,
which is a const char[1].

For some reason, storing the result of constData() in a temporary and
indexing off of that fixes the issue.

Potentially adding Q_ASSUME(d.data()[d.size] == '\0'); in some
strategic place would fix it, too, but would incur runtime overhead.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105348

Task-number: QTBUG-103923
Pick-to: 6.3 6.2
Change-Id: Ia6e24e01d1c2a6bd9d91d4d082df9fba0d5c668f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2022-05-31 23:43:32 +00:00
.github/workflows Repair github action workflow 2021-11-10 18:57:33 +01:00
bin CMake: Automatically use Xcode generator in qt-cmake + iOS 2022-05-20 13:06:00 +02:00
cmake Avoid some new clang 14 warnings on Android NDK 24 build 2022-05-27 17:28:37 +03:00
coin CI: add Windows host support for QNX 2022-04-05 17:03:40 +03:00
config.tests CMake: Test the linker too for -mno-direct-extern-access 2022-05-25 16:29:31 -07:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Doc: Fix typo in the online documentation template 2022-05-31 10:41:36 +02:00
examples Remove unnecessary dependency to OpenGL 2022-05-30 11:03:19 +03:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
libexec Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
LICENSES Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
mkspecs wasm: update emscripten to 3.1.10 2022-05-27 17:46:29 +10:00
qmake Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
src QFontEngine: fix GCC 12 -Werror=array-bounds 2022-05-31 23:43:32 +00:00
tests Add new map methods for QColorTransform 2022-05-31 22:23:40 +02:00
util Core: make CLDR data constexpr 2022-05-27 09:33:28 +08:00
.cmake.conf cmake: only use qtbase configuration in qtbase 2022-03-18 12:33:10 +01:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore Assume qhelpgenerator in libexec instead of bin 2021-11-08 19:27:32 +01:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
CMakeLists.txt Use REALPATH based check for symbolic links on Windows 2022-01-07 14:31:38 +01:00
conanfile.py Conan: Fix how conans.model.options.PackageOption value is evaluated 2022-05-27 07:17:21 +03:00
config_help.txt Build system: Allow user to enable Intel CET 2022-04-06 13:06:24 +08:00
configure Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
configure.bat Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
configure.cmake CMake: Test the linker too for -mno-direct-extern-access 2022-05-25 16:29:31 -07:00
dependencies.yaml Re-add dependencies.yaml now that qt5.git wip/qt6 builds fine 2019-09-18 13:19:31 +02:00
qt_cmdline.cmake Build system: Allow user to enable Intel CET 2022-04-06 13:06:24 +08:00
sync.profile QVector: make sure the forwarding headers for the Java iterators exist 2022-05-23 14:53:18 -07:00