You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've discovered running the test suite on a platform which does not support unaligned access, that under tst_qt5compat_json, the test tst_QtJson::invalidBinaryData() invokes a lot of UB by issuing unaligned accesses. This is the only test which has this problem - the rest of the test suite is perfectly fine.
Below is a sample output from UBSAN, compiled with -fsanitize=alignment. This also includes qtcore-6.8.0 built with the same flags, since some of the accesses technically occur there.
7/12 Testing: tst_qt5compat_json
7/12 Test: tst_qt5compat_json
Command: "/usr/bin/cmake" "-P" "/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999_build/tests/auto/core5/serialization/json/tst_qt5compat_jsonWrapperRelWithDebInfo.cmake"
Directory: /var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999_build/tests/auto/core5/serialization/json
"tst_qt5compat_json" start time: Feb 29 22:26 UTC
Output:
----------------------------------------------------------
********* Start testing of tst_QtJson *********
Config: Using QtTest library 6.8.0, Qt 6.8.0 (power64-little_endian-lp64 shared (dynamic) release build; by GCC 13.2.1 20240113), gentoo 2.14
PASS : tst_QtJson::initTestCase()
PASS : tst_QtJson::fromBinary()
PASS : tst_QtJson::toAndFromBinary(test.json)
PASS : tst_QtJson::toAndFromBinary(test2.json)
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson.cpp:368:38: runtime error: member call on misaligned address 0x000150be9c53 for type 'const struct offset', which requires 4 byte alignment
0x000150be9c53: note: pointer points here
00 00 00 04 22 00 00 00 00 00 00 00 24 00 00 00 1c 00 6a 73 01 00 00 00 04 02 00 00 23 00 00 00
^
/usr/include/qt6/QtCore/qendian.h:258:48: runtime error: member access within misaligned address 0x000150be9c53 for type 'const struct QSpecialInteger', which requires 4 byte alignment
0x000150be9c53: note: pointer points here
00 00 00 04 22 00 00 00 00 00 00 00 24 00 00 00 1c 00 6a 73 01 00 00 00 04 02 00 00 23 00 00 00
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:320:96: runtime error: member call on misaligned address 0x000150be9c53 for type 'const struct offset', which requires 4 byte alignment
0x000150be9c53: note: pointer points here
00 00 00 04 22 00 00 00 00 00 00 00 24 00 00 00 1c 00 6a 73 01 00 00 00 04 02 00 00 23 00 00 00
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson.cpp:371:24: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson.cpp:371:48: runtime error: member call on misaligned address 0x000150be9c53 for type 'const struct offset', which requires 4 byte alignment
0x000150be9c53: note: pointer points here
00 00 00 04 22 00 00 00 00 00 00 00 24 00 00 00 1c 00 6a 73 01 00 00 00 04 02 00 00 23 00 00 00
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:483:32: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:483:32: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:483:16: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:426:66: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:426:66: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct qle_bitfield', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:426:38: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/usr/include/qt6/QtCore/6.8.0/QtCore/private/qendian_p.h:173:42: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct QSpecialIntegerBitfieldUnion', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/usr/include/qt6/QtCore/6.8.0/QtCore/private/qendian_p.h:60:41: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Storage', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:484:35: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:473:32: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:473:32: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:473:16: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:474:35: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson.cpp:376:30: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson.cpp:376:30: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson.cpp:376:17: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Entry', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson.cpp:463:17: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:432:56: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:432:56: runtime error: member call on misaligned address 0x000150be9aea for type 'const struct qle_bitfield', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:432:32: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Value', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/usr/include/qt6/QtCore/6.8.0/QtCore/private/qendian_p.h:173:42: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct QSpecialIntegerBitfieldUnion', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/usr/include/qt6/QtCore/6.8.0/QtCore/private/qendian_p.h:60:41: runtime error: member access within misaligned address 0x000150be9aea for type 'const struct Storage', which requires 4 byte alignment
0x000150be9aea: note: pointer points here
00 00 04 00 70 61 56 00 04 00 00 00 8b 00 74 10 65 61 10 00 65 78 61 6d 70 fa 6f 73 73 61 72 79
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:485:29: runtime error: member call on misaligned address 0x000150be9b06 for type 'const struct Entry', which requires 4 byte alignment
0x000150be9b06: note: pointer points here
73 61 72 79 00 00 80 ff ff ff ff 7f 10 00 72 61 00 00 48 00 41 69 76 00 fa 1e 00 00 6c 75 73 73
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:179:20: runtime error: member access within misaligned address 0x000150be9b0a for type 'const struct Data', which requires 4 byte alignment
0x000150be9b0a: note: pointer points here
00 00 80 ff ff ff ff 7f 10 00 72 61 00 00 48 00 41 69 76 00 fa 1e 00 00 6c 75 73 73 54 65 55 6d
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:179:20: runtime error: member call on misaligned address 0x000150be9b0a for type 'const struct qle_uint', which requires 4 byte alignment
0x000150be9b0a: note: pointer points here
00 00 80 ff ff ff ff 7f 10 00 72 61 00 00 48 00 41 69 76 00 fa 1e 00 00 6c 75 73 73 54 65 55 6d
^
/var/tmp/portage/dev-qt/qt5compat-6.9999/work/qt5compat-6.9999/src/core5/serialization/qbinaryjson_p.h:179:28: runtime error: member access within misaligned address 0x000150be9b0a for type 'const struct Data', which requires 4 byte alignment
0x000150be9b0a: note: pointer points here
00 00 80 ff ff ff ff 7f 10 00 72 61 00 00 48 00 41 69 76 00 fa 1e 00 00 6c 75 73 73 54 65 55 6d
^
PASS : tst_QtJson::invalidBinaryData()
PASS : tst_QtJson::compactArray()
PASS : tst_QtJson::compactObject()
PASS : tst_QtJson::validation()
PASS : tst_QtJson::testCompactionError()
PASS : tst_QtJson::cleanupTestCase()
Totals: 10 passed, 0 failed, 0 skipped, 0 blacklisted, 15849ms
********* Finished testing of tst_QtJson *********
<end of output>
Test time = 15.87 sec
----------------------------------------------------------
Test Passed.
"tst_qt5compat_json" end time: Feb 29 22:26 UTC
"tst_qt5compat_json" time elapsed: 00:00:15
----------------------------------------------------------
Hi, I've discovered running the test suite on a platform which does not support unaligned access, that under
tst_qt5compat_json
, the testtst_QtJson::invalidBinaryData()
invokes a lot of UB by issuing unaligned accesses. This is the only test which has this problem - the rest of the test suite is perfectly fine.Below is a sample output from UBSAN, compiled with
-fsanitize=alignment
. This also includes qtcore-6.8.0 built with the same flags, since some of the accesses technically occur there.Here's a backtrace from the crashing platform:
The text was updated successfully, but these errors were encountered: