]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix overflow in compare_modules return value.
authorUlrich Drepper <drepper@redhat.com>
Tue, 11 Jul 2006 22:32:28 +0000 (22:32 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 11 Jul 2006 22:32:28 +0000 (22:32 +0000)
config/elfutils.spec.in
libdwfl/ChangeLog
libdwfl/dwfl_module.c

index 32d87b4972792baac5a156e06d3cb7a8ff8f3328..6c5f7a5aa6813a3b8ab0b430b868a80ce9777ad2 100644 (file)
@@ -170,11 +170,6 @@ hes.
 - The license is now GPL for most files.  The libelf, libebl, libdw,and 
 libdwfl libraries have additional exceptions.  Add reference toOIN.
 
-* Thu Mar 30 2006 Roland McGrath <roland@redhat.com> 0.120-1
-- Bug fixes.
-- dwarf.h updated for DWARF 3.0 final specification.
-- libdwfl: New function dwfl_version.
-
 * Thu Jan 12 2006 Roland McGrath <roland@redhat.com> 0.119-1
 - elflint: more tests.
 - libdwfl: New function dwfl_module_register_names.
index 96fe56bc6c6f613c70e9e75cd64d7e8c93107b9d..bdfd12c248c33ae5fc44656491b4a564b1896170 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-11  Ulrich Drepper  <drepper@redhat.com>
+
+       * dwfl_module.c (compare_modules): Don't return GElf_Sxword value,
+       it can overflow the return value type.
+       Patch by Tim Moore <timoore@redhat.com>.
+
 2006-06-13  Roland McGrath  <roland@redhat.com>
 
        * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo.
index 022bfea1c0c81d5fcdae1043eebf2f9a096b2d1a..6f3aa849c077c5e3e795c4540eac54d215012e4c 100644 (file)
@@ -1,5 +1,5 @@
 /* Maintenance of module list in libdwfl.
-   Copyright (C) 2005 Red Hat, Inc.
+   Copyright (C) 2005, 2006 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -161,6 +161,7 @@ dwfl_report_module (Dwfl *dwfl, const char *name,
 }
 INTDEF (dwfl_report_module)
 
+
 static int
 compare_modules (const void *a, const void *b)
 {
@@ -170,7 +171,13 @@ compare_modules (const void *a, const void *b)
     return -1;
   if (m2 == NULL)
     return 1;
-  return (GElf_Sxword) (m1->low_addr - m2->low_addr);
+
+  GElf_Sxword diff = m1->low_addr - m2->low_addr;
+  if (diff < 0)
+    return -1;
+  if (diff > 0)
+    return 1;
+  return 0;
 }