mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 12:03:41 +01:00
elfxx: store elf image pointer and size after mapping image
If loading debug link is not successful, the initial NULL pointer for ei->image will eventually be restored, causing segfault during a later call to valid_object. Move populating the prev_image and prev_size to after elf_map_image() to fix this. Signed-off-by: Hans-Christian Noren Egtvedt <hegtvedt@cisco.com>
This commit is contained in:
parent
f248ac0c6e
commit
46c336d18f
1 changed files with 5 additions and 2 deletions
|
@ -386,8 +386,8 @@ elf_w (load_debuglink) (const char* file, struct elf_image *ei, int is_local)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
Elf_W (Shdr) *shdr;
|
Elf_W (Shdr) *shdr;
|
||||||
Elf_W (Ehdr) *prev_image = ei->image;
|
Elf_W (Ehdr) *prev_image;
|
||||||
off_t prev_size = ei->size;
|
off_t prev_size;
|
||||||
|
|
||||||
if (!ei->image)
|
if (!ei->image)
|
||||||
{
|
{
|
||||||
|
@ -396,6 +396,9 @@ elf_w (load_debuglink) (const char* file, struct elf_image *ei, int is_local)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prev_image = ei->image;
|
||||||
|
prev_size = ei->size;
|
||||||
|
|
||||||
/* Ignore separate debug files which contain a .gnu_debuglink section. */
|
/* Ignore separate debug files which contain a .gnu_debuglink section. */
|
||||||
if (is_local == -1) {
|
if (is_local == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue