Prevent segfault in stabs64_typevalue
authorCharles Crayne <chuck@thor.crayne.org>
Sun, 27 Jan 2008 20:49:20 +0000 (12:49 -0800)
committerCharles Crayne <chuck@thor.crayne.org>
Sun, 27 Jan 2008 20:49:20 +0000 (12:49 -0800)
Prevent segfault when type == STT_OBJECT and no symbol
has been defined.

output/outelf32.c
output/outelf64.c

index cb8b319..c11c4e4 100644 (file)
@@ -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;
     }
index 70645ed..0dd1b6f 100644 (file)
@@ -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;
     }