diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-10-04 14:02:13 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-10-04 14:02:13 +0200 |
commit | f82055f8247478d9e2c00f2a442248e42188b8d1 (patch) | |
tree | 6e4b1b74e0203bab0c29cb028d8c051e81714ab0 /libgfortran/generated/in_pack_c4.c | |
parent | 92e9e971ced90af5a825ae4b35ad6c98c9ab86da (diff) | |
download | gcc-f82055f8247478d9e2c00f2a442248e42188b8d1.zip gcc-f82055f8247478d9e2c00f2a442248e42188b8d1.tar.gz gcc-f82055f8247478d9e2c00f2a442248e42188b8d1.tar.bz2 |
diagnostic, pch: Fix up the new diagnostic PCH methods for ubsan checking [PR116936]
The PR notes that the new pch_save/pch_restore methods I've added
recently invoke UB if either m_classification_history.address ()
or m_push_list.address () is NULL (which can happen if those vectors
are empty (and in the pch_save case nothing has been pushed into them
before either). While the corresponding length is necessarily 0,
fwrite (NULL, something, 0, f) or
fread (NULL, something, 0, f) still invoke UB.
The following patch fixes that by not calling fwrite/fread if the
corresponding length is 0.
2024-10-04 Jakub Jelinek <jakub@redhat.com>
PR pch/116936
* diagnostic.cc (diagnostic_option_classifier::pch_save): Only call
fwrite if corresponding length is non-zero.
(diagnostic_option_classifier::pch_restore): Only call fread if
corresponding length is non-zero.
Diffstat (limited to 'libgfortran/generated/in_pack_c4.c')
0 files changed, 0 insertions, 0 deletions