From a8acd1c48099154ef824961457aa1aecfc10bbee Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Thu, 15 Dec 2005 16:17:50 +0000 Subject: [PATCH] unwind-dw2-fde-glibc.c (_Unwind_IteratePhdrCallback): Guard against prev_cache_entry == NULL when moving a cache entry to the head of... 2005-12-15 Andrew Haley * unwind-dw2-fde-glibc.c (_Unwind_IteratePhdrCallback): Guard against prev_cache_entry == NULL when moving a cache entry to the head of the list. From-SVN: r108582 --- gcc/ChangeLog | 6 ++++++ gcc/unwind-dw2-fde-glibc.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a79601e179..7c5d580c3ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-12-15 Andrew Haley + + * unwind-dw2-fde-glibc.c (_Unwind_IteratePhdrCallback): Guard + against prev_cache_entry == NULL when moving a cache entry to the + head of the list. + 2005-12-15 Nathan Sidwell * config/mt/mt.c (mt_override_options): Require lower case diff --git a/gcc/unwind-dw2-fde-glibc.c b/gcc/unwind-dw2-fde-glibc.c index e7bd31b1583..25bf2bb1bce 100644 --- a/gcc/unwind-dw2-fde-glibc.c +++ b/gcc/unwind-dw2-fde-glibc.c @@ -257,7 +257,10 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr) if (size >= sizeof (struct ext_dl_phdr_info)) { - if (last_cache_entry != NULL) + /* Move the cache entry we're about to overwrite to the head of + the list. If either last_cache_entry or prev_cache_entry are + NULL, that cache entry is already at the head. */ + if (last_cache_entry != NULL && prev_cache_entry != NULL) { prev_cache_entry->link = last_cache_entry->link; last_cache_entry->link = frame_hdr_cache_head; -- 2.30.2