]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix bogus Address Sanitizer stack-buffer-overflow on packed array copy
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 27 May 2024 14:46:03 +0000 (16:46 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 21 Jun 2024 08:34:23 +0000 (10:34 +0200)
commit2b510ac3aa521c6984495c63547914f271f1f51c
treec0824a3b35c487868fde29f83987a16281395c4d
parentd69c53f73dae181c79f6ec6c7276a172476a2728
ada: Fix bogus Address Sanitizer stack-buffer-overflow on packed array copy

The Address Sanitizer considers that the padding at the end of a justified
modular type may be accessed through the object, but it is never accessed
and therefore can always be reused.

gcc/ada/

* gcc-interface/decl.cc (gnat_to_gnu_entity) <discrete_type>: Set
the TYPE_JUSTIFIED_MODULAR_P flag earlier.
* gcc-interface/misc.cc (gnat_unit_size_without_reusable_padding):
New function.
(LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING): Redefine to above
function.
gcc/ada/gcc-interface/decl.cc
gcc/ada/gcc-interface/misc.cc