From 92cb18f2a8a08c0c5205bb8359dd94904a7b420f Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Wed, 18 Mar 2009 22:26:29 +0100 Subject: [PATCH] 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. --- output/outelf32.c | 2 ++ output/outelf64.c | 2 ++ 2 files changed, 4 insertions(+) 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; -- 2.11.4.GIT