summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain
diff options
context:
space:
mode:
authorkaiw <kaiw@FreeBSD.org>2014-01-19 13:38:40 +0000
committerkaiw <kaiw@FreeBSD.org>2014-01-19 13:38:40 +0000
commitda160d852b438adb9cbef1fbf431fa44eaecfbcd (patch)
treed2c63c95d8d4ca1eecf870cb8be90ee95d81d4d7 /contrib/elftoolchain
parent80ef55c0ac0204f2d98380c0255b2f7a609ed8db (diff)
downloadFreeBSD-src-da160d852b438adb9cbef1fbf431fa44eaecfbcd.zip
FreeBSD-src-da160d852b438adb9cbef1fbf431fa44eaecfbcd.tar.gz
Add a sanity check: The provided offset for the desired location list
should not exceed the size of the .debug_loc section.
Diffstat (limited to 'contrib/elftoolchain')
-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 8b59986..8030e9a 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);
OpenPOWER on IntegriCloud