From: Petr Machata Date: Wed, 18 Feb 2009 14:27:56 +0000 (+0100) Subject: Fix operation of reloc functions when relocation data are absent X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a2185f4b1e64d5fb009959c3d29a48322a5c59c;p=thirdparty%2Felfutils.git Fix operation of reloc functions when relocation data are absent --- diff --git a/src/dwarflint.c b/src/dwarflint.c index 6952c90aa..87100fce9 100644 --- a/src/dwarflint.c +++ b/src/dwarflint.c @@ -2286,7 +2286,7 @@ relocation_next (struct relocation_data *reloc, uint64_t offset, GElf_Rela *rela_mem, struct where *where, enum skip_type st) { - if (reloc == NULL) + if (reloc == NULL || reloc->data == NULL) return NULL; while (reloc->index < reloc->count) @@ -2336,6 +2336,9 @@ static void relocation_skip (struct relocation_data *reloc, uint64_t offset, struct where *where, enum skip_type st) { + if (reloc == NULL || reloc->data == NULL) + return; + GElf_Rela rela_mem; relocation_next (reloc, offset - 1, &rela_mem, where, st); } @@ -2344,6 +2347,9 @@ relocation_skip (struct relocation_data *reloc, uint64_t offset, static void relocation_skip_rest (struct relocation_data *reloc, enum section_id sec) { + if (reloc == NULL || reloc->data == NULL) + return; + GElf_Rela rela_mem; relocation_next (reloc, (uint64_t)-1, &rela_mem, &WHERE (sec, NULL), skip_mismatched);