diff options
author | Alan Modra <amodra@gmail.com> | 2022-10-29 10:31:01 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-10-29 15:23:47 +1030 |
commit | 13de66dd346c4a4eddf62c3b97747d707c5ed78e (patch) | |
tree | c21e5dbdabb78e4d1a027cf28b78a0d1a3ac7d6c /bfd/som.c | |
parent | 0ce50fc900a53f32ed09c49ddc8cf26b517b33d1 (diff) | |
download | fsf-binutils-gdb-13de66dd346c4a4eddf62c3b97747d707c5ed78e.zip fsf-binutils-gdb-13de66dd346c4a4eddf62c3b97747d707c5ed78e.tar.gz fsf-binutils-gdb-13de66dd346c4a4eddf62c3b97747d707c5ed78e.tar.bz2 |
NULL dereference read in som_write_object_contents
objcopy copy_object may omit the call to bfd_copy_private_bfd_data for
various conditions deemed non-fatal, in which case obj_som_exec_data
will be NULL for the output file.
* som.c (som_finish_writing): Don't dereference NULL
obj_som_exec_data.
Diffstat (limited to 'bfd/som.c')
-rw-r--r-- | bfd/som.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -4211,7 +4211,7 @@ som_finish_writing (bfd *abfd) /* Setting of the system_id has to happen very late now that copying of BFD private data happens *after* section contents are set. */ - if (abfd->flags & (EXEC_P | DYNAMIC)) + if ((abfd->flags & (EXEC_P | DYNAMIC)) && obj_som_exec_data (abfd)) obj_som_file_hdr (abfd)->system_id = obj_som_exec_data (abfd)->system_id; else if (bfd_get_mach (abfd) == pa20) obj_som_file_hdr (abfd)->system_id = CPU_PA_RISC2_0; @@ -4242,7 +4242,8 @@ som_finish_writing (bfd *abfd) exec_header = obj_som_exec_hdr (abfd); exec_header->exec_entry = bfd_get_start_address (abfd); - exec_header->exec_flags = obj_som_exec_data (abfd)->exec_flags; + if (obj_som_exec_data (abfd)) + exec_header->exec_flags = obj_som_exec_data (abfd)->exec_flags; /* Oh joys. Ram some of the BSS data into the DATA section to be compatible with how the hp linker makes objects |