From f3d2d41e06807fcff2af2504536240eef4c483e2 Mon Sep 17 00:00:00 2001 From: Charles Crayne Date: Sun, 27 Jan 2008 12:49:20 -0800 Subject: [PATCH] Prevent segfault in stabs64_typevalue Prevent segfault when type == STT_OBJECT and no symbol has been defined. --- output/outelf32.c | 2 +- output/outelf64.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/output/outelf32.c b/output/outelf32.c index cb8b319d8..c11c4e40d 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -1486,7 +1486,7 @@ void stabs32_typevalue(int32_t type) stype = STT_NOTYPE; break; } - if (stype == STT_OBJECT && !lastsym->type) { + if (stype == STT_OBJECT && lastsym && !lastsym->type) { lastsym->size = ssize; lastsym->type = stype; } diff --git a/output/outelf64.c b/output/outelf64.c index 70645edb4..0dd1b6fda 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -1500,7 +1500,7 @@ void stabs64_typevalue(int32_t type) stype = STT_NOTYPE; break; } - if (stype == STT_OBJECT && !lastsym->type) { + if (stype == STT_OBJECT && lastsym && !lastsym->type) { lastsym->size = ssize; lastsym->type = stype; }