History log of /PHP-8.2/ext/ffi/tests/gh10403.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 560ca9c7 24-Jan-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix incorrect bitshifting and masking in ffi bitfield (#10403)

When a uint8_t is bitshifted to the left, it is actually promoted to an
int. For the current code this has the effect of a

Fix incorrect bitshifting and masking in ffi bitfield (#10403)

When a uint8_t is bitshifted to the left, it is actually promoted to an
int. For the current code this has the effect of a wrong sign-extension,
and the result will also wrongly become zero when insert_pos >= 32.
Fix this by adding an explicit cast.
Furthermore, the partial prefix byte mask was computed incorrectly: the
byte is already shifted so the mask should not account for the shift.

show more ...