public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] PR25648, objcopy SIGSEGV in ihex_write_record
@ 2020-03-19  1:00 gdb-buildbot
  2020-03-19  1:00 ` Failures on Fedora-i686, branch master gdb-buildbot
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gdb-buildbot @ 2020-03-19  1:00 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 6b5e16ffd3e8886fa3fb90d63e3200fcc373848e ***

commit 6b5e16ffd3e8886fa3fb90d63e3200fcc373848e
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Tue Mar 10 10:46:17 2020 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Tue Mar 10 11:05:07 2020 +1030

    PR25648, objcopy SIGSEGV in ihex_write_record
    
    ihex_set_section_contents sorts records stored on the tdata.ihex_data
    list by address, but ihex_write_object_contents went too far in
    assuming they were not overlapping.  This patch fixes the problem by
    not assuming anything about addresses in ihex_write_object_contents.
    
            PR 25648
            * ihex.c (ihex_write_object_contents): Don't assume ordering of
            addresses here.  Remove dead code.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 371e505392..67858c7538 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-10  Alan Modra  <amodra@gmail.com>
+
+	PR 25648
+	* ihex.c (ihex_write_object_contents): Don't assume ordering of
+	addresses here.
+
 2020-03-09  Alan Modra  <amodra@gmail.com>
 
 	* wasm-module.c (wasm_scan): Sanity check file name length
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 68671cc623..ca36043fe2 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -811,16 +811,15 @@ ihex_write_object_contents (bfd *abfd)
 	  if (count > CHUNK)
 	    now = CHUNK;
 
-	  if (where > segbase + extbase + 0xffff)
+	  if (where < extbase
+	      || where - extbase < segbase
+	      || where - extbase - segbase > 0xffff)
 	    {
 	      bfd_byte addr[2];
 
 	      /* We need a new base address.  */
-	      if (where <= 0xfffff)
+	      if (extbase == 0 && where <= 0xfffff)
 		{
-		  /* The addresses should be sorted.  */
-		  BFD_ASSERT (extbase == 0);
-
 		  segbase = where & 0xf0000;
 		  addr[0] = (bfd_byte)(segbase >> 12) & 0xff;
 		  addr[1] = (bfd_byte)(segbase >> 4) & 0xff;


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-22  6:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19  1:00 [binutils-gdb] PR25648, objcopy SIGSEGV in ihex_write_record gdb-buildbot
2020-03-19  1:00 ` Failures on Fedora-i686, branch master gdb-buildbot
2020-03-19  1:17 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-03-19  1:32 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-03-19  1:51 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-03-19  2:10 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-03-19  2:42 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-03-21 12:10 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
2020-03-21 19:42 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2020-03-22  6:15 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).