+2001-09-17 H.J. Lu <hjl@gnu.org>
+
+ * dwarf1.c (parse_die): Take a new arg for the end of the
+ section. Return false if die is beyond the section.
+ (parse_functions_in_unit): Pass the end of the section to
+ parse_die ().
+ (_bfd_dwarf1_find_nearest_line): Likewise.
+
2001-09-14 Michael Rauch <mrauch@netbsd.org>
* elf32-sparc.c (elf32_sparc_relocate_section): Treat R_SPARC_UA32
static struct dwarf1_unit *alloc_dwarf1_unit PARAMS ((struct dwarf1_debug *));
static struct dwarf1_func *alloc_dwarf1_func
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
-static boolean parse_die PARAMS ((bfd *, struct die_info *, char *));
+static boolean parse_die PARAMS ((bfd *, struct die_info *, char *, char *));
static boolean parse_line_table
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
static boolean parse_functions_in_unit
Return false if the die is invalidly formatted; true otherwise. */
static boolean
-parse_die (abfd, aDieInfo, aDiePtr)
+parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
bfd* abfd;
struct die_info* aDieInfo;
char* aDiePtr;
+ char* aDiePtrEnd;
{
char* this_die = aDiePtr;
char* xptr = this_die;
/* First comes the length. */
aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
xptr += 4;
- if (aDieInfo->length == 0)
+ if (aDieInfo->length == 0
+ || (this_die + aDieInfo->length) >= aDiePtrEnd)
return false;
if (aDieInfo->length < 6)
{
{
struct die_info eachDieInfo;
- if (! parse_die (stash->abfd, &eachDieInfo, eachDie))
+ if (! parse_die (stash->abfd, &eachDieInfo, eachDie,
+ stash->debug_section_end))
return false;
if (eachDieInfo.tag == TAG_global_subroutine
{
struct die_info aDieInfo;
- if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie))
+ if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie,
+ stash->debug_section_end))
return false;
if (aDieInfo.tag == TAG_compile_unit)