From 62cc2e1fa2d79bc4a8cf92d9e9b6216f97d0a9ee Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 10 Aug 2009 22:02:41 +0000 Subject: [PATCH] include/coff/ Fix references past allocated memory for i386-*-go32. * ti.h (COFF_ADJUST_FILEHDR_IN_POST, COFF_ADJUST_FILEHDR_OUT_POST): Reference F_TARGET_ID only when !COFF0_P. --- include/coff/ChangeLog | 6 ++++++ include/coff/ti.h | 16 +++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index a38228b33db..4aa9dc10774 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,9 @@ +2009-08-10 Jan Kratochvil + + Fix references past allocated memory for i386-*-go32. + * ti.h (COFF_ADJUST_FILEHDR_IN_POST, COFF_ADJUST_FILEHDR_OUT_POST): + Reference F_TARGET_ID only when !COFF0_P. + 2009-08-10 Jan Kratochvil Stop using bfd_usrdata in libbfd. diff --git a/include/coff/ti.h b/include/coff/ti.h index e0e17293d93..7f3ad7e530c 100644 --- a/include/coff/ti.h +++ b/include/coff/ti.h @@ -102,19 +102,21 @@ struct external_filehdr #define COFF_ADJUST_FILEHDR_IN_POST(abfd, src, dst) \ do \ { \ - ((struct internal_filehdr *)(dst))->f_target_id = \ - H_GET_16 (abfd, ((FILHDR *)(src))->f_target_id); \ + if (!COFF0_P (abfd)) \ + ((struct internal_filehdr *)(dst))->f_target_id = \ + H_GET_16 (abfd, ((FILHDR *)(src))->f_target_id); \ } \ while (0) #endif #ifndef COFF_ADJUST_FILEHDR_OUT_POST #define COFF_ADJUST_FILEHDR_OUT_POST(abfd, src, dst) \ - do \ - { \ - H_PUT_16 (abfd, ((struct internal_filehdr *)(src))->f_target_id, \ - ((FILHDR *)(dst))->f_target_id); \ - } \ + do \ + { \ + if (!COFF0_P (abfd)) \ + H_PUT_16 (abfd, ((struct internal_filehdr *)(src))->f_target_id, \ + ((FILHDR *)(dst))->f_target_id); \ + } \ while (0) #endif -- 2.30.2