History log of /PHP-8.1/ext/pdo_firebird/tests/gh10908.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 21e0305f 23-Mar-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10908: Bus error with PDO Firebird on RPI with 64 bit kernel and 32 bit userland

The alignment of sqldata is in most cases only the basic alignment,
so the code type-puns it to a

Fix GH-10908: Bus error with PDO Firebird on RPI with 64 bit kernel and 32 bit userland

The alignment of sqldata is in most cases only the basic alignment,
so the code type-puns it to a larger type, it *can* crash due to the
misaligned access. This is only an issue for types > 4 bytes because
every sensible system requires an alignment of at least 4 bytes for
allocated data.

Even though this patch uses memcpy, the compiler is smart enough to
optimise it to something more efficient, especially on x86.
This is just the usual approach to solve these alignment problems.

Actually, unaligned memory access is undefined behaviour, so even on x86
platforms, where the bug doesn't cause a crash, this can be problematic.
Furthermore, even though the issue talks about a 64-bit kernel and
32-bit userspace, this doesn't necessarily need to be the case to
trigger this crash.

Test was Co-authored-by: rvk01

Closes GH-10920.

show more ...