More fixes for memory access errors when running readelf on fuzzed binaries.

PR binutils/17531
	* dwarf.c (process_debug_info): Check for abbrev_base being larger
	than the section size.
	(process_cu_tu_index): Use xcalloc2 to allocate the CU and TU
	arrays.
	(xcalloc2): New function.  Like xcalloc, but checks for overflow.
	* dwarf.h (xcalloc2): Prototype.
This commit is contained in:
Nick Clifton
2015-01-12 16:08:41 +00:00
parent 696025802e
commit 72c61a0d1e
3 changed files with 30 additions and 3 deletions

View File

@@ -251,6 +251,7 @@ extern void dwarf_select_sections_all (void);
extern unsigned int * find_cu_tu_set (void *, unsigned int);
extern void * cmalloc (size_t, size_t);
extern void * xcalloc2 (size_t, size_t);
extern void * xcmalloc (size_t, size_t);
extern void * xcrealloc (void *, size_t, size_t);