* elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Avoid
authorAlan Modra <amodra@gmail.com>
Fri, 25 Jan 2002 06:24:34 +0000 (06:24 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 25 Jan 2002 06:24:34 +0000 (06:24 +0000)
unsigned overflow when new_offset < old_offset.

bfd/ChangeLog
bfd/elf-eh-frame.c

index d920d182bbbb7e4ed90e8907749686dde23fb3d3..e30f06a93cfe314f57710b5f71a880926a7631ad 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-25  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Avoid
+       unsigned overflow when new_offset < old_offset.
+
 2002-24-01  Philipp Thomas  <pthomas@suse.de>
 
        * bfd.c (_bfd_abort): Fix typo.
index 56a59da410c2b2a366da3891a30de491bb5fe2aa..b479c00f3233886ffb3aab0ab74c0217dc26abf4 100644 (file)
@@ -1,5 +1,5 @@
 /* .eh_frame section optimization.
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -867,8 +867,8 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
              + sec_info->entry[mid].lsda_offset)))
     return (bfd_vma) -1;
 
-  return (offset
-         + (sec_info->entry[mid].new_offset - sec_info->entry[mid].offset));
+  return (offset + sec_info->entry[mid].new_offset
+         - sec_info->entry[mid].offset);
 }
 
 /* Write out .eh_frame section.  This is called with the relocated