aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Wang <kaiw@FreeBSD.org>2014-01-19 13:38:40 +0000
committerKai Wang <kaiw@FreeBSD.org>2014-01-19 13:38:40 +0000
commit255d921adcedcece0bcac9b966b28ed85e3c6526 (patch)
treed2c63c95d8d4ca1eecf870cb8be90ee95d81d4d7
parent9c016dc4b2445d76ba4b508aed574550457dd9e7 (diff)
downloadsrc-255d921adcedcece0bcac9b966b28ed85e3c6526.tar.gz
src-255d921adcedcece0bcac9b966b28ed85e3c6526.zip
Add a sanity check: The provided offset for the desired location list
should not exceed the size of the .debug_loc section.
Notes
Notes: svn path=/projects/elftoolchain/; revision=260878
-rw-r--r--contrib/elftoolchain/libdwarf/libdwarf_loclist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/elftoolchain/libdwarf/libdwarf_loclist.c b/contrib/elftoolchain/libdwarf/libdwarf_loclist.c
index 8b599868d00d..8030e9a67852 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_loclist.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_loclist.c
@@ -127,6 +127,11 @@ _dwarf_loclist_add(Dwarf_Debug dbg, Dwarf_CU cu, uint64_t lloff,
return (DW_DLE_NO_ENTRY);
}
+ if (lloff >= ds->ds_size) {
+ DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
+ return (DW_DLE_NO_ENTRY);
+ }
+
if ((ll = malloc(sizeof(struct _Dwarf_Loclist))) == NULL) {
DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
return (DW_DLE_MEMORY);