diff options
author | Richard Henderson <rth@redhat.com> | 2004-03-22 03:55:50 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2004-03-22 03:55:50 +0000 |
commit | 6339d4fc9f8014772108efb042b929efdafcb40f (patch) | |
tree | 411dae38676000811f0cca38ee6aa50074fda653 | |
parent | 8478a5db798d53fa7120f2e4a80a72c9fd458e11 (diff) | |
download | binutils-redhat-6339d4fc9f8014772108efb042b929efdafcb40f.tar.gz |
* readelf.c (display_debug_frames): Don't crash for mismatched
DW_CFA_restore_state.
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/readelf.c | 20 |
2 files changed, 18 insertions, 7 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 33cb21908b..2e41bc8b50 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2004-03-21 Richard Henderson <rth@redhat.com> + + * readelf.c (display_debug_frames): Don't crash for mismatched + DW_CFA_restore_state. + 2004-03-19 Alan Modra <amodra@bigpond.net.au> * Makefile.am: Run "make dep-am". diff --git a/binutils/readelf.c b/binutils/readelf.c index ddbf7819e3..3561eff0a6 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -9150,13 +9150,19 @@ display_debug_frames (Elf_Internal_Shdr *section, if (! do_debug_frames_interp) printf (" DW_CFA_restore_state\n"); rs = remembered_state; - remembered_state = rs->next; - frame_need_space (fc, rs->ncols-1); - memcpy (fc->col_type, rs->col_type, rs->ncols); - memcpy (fc->col_offset, rs->col_offset, rs->ncols * sizeof (int)); - free (rs->col_type); - free (rs->col_offset); - free (rs); + if (rs) + { + remembered_state = rs->next; + frame_need_space (fc, rs->ncols-1); + memcpy (fc->col_type, rs->col_type, rs->ncols); + memcpy (fc->col_offset, rs->col_offset, + rs->ncols * sizeof (int)); + free (rs->col_type); + free (rs->col_offset); + free (rs); + } + else if (do_debug_frames_interp) + printf ("Mismatched DW_CFA_restore_state\n"); break; case DW_CFA_def_cfa: |