svn commit: r260878 - projects/elftoolchain/contrib/elftoolchain/libdwarf

Kai Wang kaiw at FreeBSD.org
Sun Jan 19 13:38:40 UTC 2014


Author: kaiw
Date: Sun Jan 19 13:38:40 2014
New Revision: 260878
URL: http://svnweb.freebsd.org/changeset/base/260878

Log:
  Add a sanity check: The provided offset for the desired location list
  should not exceed the size of the .debug_loc section.

Modified:
  projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c

Modified: projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c
==============================================================================
--- projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c	Sun Jan 19 07:44:14 2014	(r260877)
+++ projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c	Sun Jan 19 13:38:40 2014	(r260878)
@@ -127,6 +127,11 @@ _dwarf_loclist_add(Dwarf_Debug dbg, Dwar
 		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);


More information about the svn-src-projects mailing list