diff options
author | kaiw <kaiw@FreeBSD.org> | 2014-01-19 13:38:40 +0000 |
---|---|---|
committer | kaiw <kaiw@FreeBSD.org> | 2014-01-19 13:38:40 +0000 |
commit | da160d852b438adb9cbef1fbf431fa44eaecfbcd (patch) | |
tree | d2c63c95d8d4ca1eecf870cb8be90ee95d81d4d7 /contrib/elftoolchain/libdwarf | |
parent | 80ef55c0ac0204f2d98380c0255b2f7a609ed8db (diff) | |
download | FreeBSD-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/libdwarf')
-rw-r--r-- | contrib/elftoolchain/libdwarf/libdwarf_loclist.c | 5 |
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); |