diff options
| author | Mark Wielaard <[email protected]> | 2015-04-02 13:39:03 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-04-14 09:51:32 +0200 |
| commit | 7d3879e8580ae578afa64061026226e98f6f53be (patch) | |
| tree | 9da77e5db5fd3dc90107e6ad344b3dd97e606297 /libdwfl | |
| parent | fe7dbcaa118e838ef590ecf3cc3e93c5765f08d9 (diff) | |
libdwfl: Correct off-by-one check in segment.c insert.
Caught by running run-backtrace-core-x32.sh under valgrind.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdwfl')
| -rw-r--r-- | libdwfl/ChangeLog | 6 | ||||
| -rw-r--r-- | libdwfl/segment.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 143d3814..d4cd3f5a 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,6 +1,10 @@ +2015-04-02 Mark Wielaard <[email protected]> + + * segment.c (insert): Check correct number of lookup_elts. + 2015-03-31 Mark Wielaard <[email protected]> - * core-file.c (core_file_read_eagerly): Special case small images. + * core-file.c (core_file_read_eagerly): Special case small images. 2015-01-26 Mark Wielaard <[email protected]> diff --git a/libdwfl/segment.c b/libdwfl/segment.c index 92769174..2983cf23 100644 --- a/libdwfl/segment.c +++ b/libdwfl/segment.c @@ -1,5 +1,5 @@ /* Manage address space lookup table for libdwfl. - Copyright (C) 2008, 2009, 2010, 2013 Red Hat, Inc. + Copyright (C) 2008, 2009, 2010, 2013, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -50,7 +50,8 @@ static bool insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx) { bool need_start = (i == 0 || dwfl->lookup_addr[i - 1] != start); - bool need_end = (i >= dwfl->lookup_elts || dwfl->lookup_addr[i + 1] != end); + bool need_end = (i + 1 >= dwfl->lookup_elts + || dwfl->lookup_addr[i + 1] != end); size_t need = need_start + need_end; if (need == 0) return false; |
