This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ensure sv bodies are properly aligned
authorTony Cook <tony@develop-help.com>
Wed, 25 Mar 2020 04:08:43 +0000 (15:08 +1100)
committerKarl Williamson <khw@cpan.org>
Sun, 29 Mar 2020 20:30:20 +0000 (14:30 -0600)
commitb11187bf165b7946337846701b6285b043e4aaa2
treefe0cf4345d9e68291e3abd60ca1869a4738cc615
parent9cb9303adf257096fc850e7b672c6504df770146
ensure sv bodies are properly aligned

In some cases SV bodies don't include the same members as lower sv type
bodies, in particular, PVMG includes an NV member, while PVCV and
other specialised bodies don't include it, so PVMG can have a larger
alignment boundary.

This can result in a PVCV having a smaller alignment boundary than
PVMG, resulting in potential undefined behaviour if a member that
is common between PVCV and PVMG is accessed on an lesser aligned
PVCV pointer.

To avoid that, ensure allocation sizes described in bodies_by_type[]
account for NV (and IV) alignment requirements.

fixes #17668
sv.c