summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Scherer <misc@n4.mandriva.com>2009-03-18 22:26:29 +0100
committerH. Peter Anvin <hpa@linux.intel.com>2009-03-18 14:47:33 -0700
commit92cb18f2a8a08c0c5205bb8359dd94904a7b420f (patch)
tree4d086b2e56443147555578f60a072eb970153e3a
parent74eed4a9b33f72560b0393ba4bfe89d07660a15d (diff)
downloadnasm-92cb18f2a8a08c0c5205bb8359dd94904a7b420f.tar.gz
outelf32/64: fix uninitialized rbtree
Fix crash caused by uninitialised memory that lead to dangling pointer in the rbtree. This can be seen by compiling zsnes 1.50, with a file that define many symbols, such as fxemu2c.asm.
-rw-r--r--output/outelf32.c2
-rw-r--r--output/outelf64.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/output/outelf32.c b/output/outelf32.c
index 604c353a..9edce370 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -602,6 +602,8 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
lastsym = sym = saa_wstruct(syms);
+ memset(&sym->symv, 0, sizeof(struct rbtree));
+
sym->strpos = pos;
sym->type = is_global ? SYM_GLOBAL : 0;
sym->other = STV_DEFAULT;
diff --git a/output/outelf64.c b/output/outelf64.c
index 24d0b81c..484c4ba4 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -638,6 +638,8 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
lastsym = sym = saa_wstruct(syms);
+ memset(&sym->symv, 0, sizeof(struct rbtree));
+
sym->strpos = pos;
sym->type = is_global ? SYM_GLOBAL : 0;
sym->other = STV_DEFAULT;