From: nasm-bot f. C. S. B. <cha...@in...> - 2020-05-05 06:57:35
|
Commit-ID: 74b2731f2cef0f1ec8c0c6e6e3dee9492b851e8c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=74b2731f2cef0f1ec8c0c6e6e3dee9492b851e8c Author: Chang S. Bae <cha...@in...> AuthorDate: Tue, 21 Apr 2020 09:23:39 +0000 Committer: Chang S. Bae <cha...@in...> CommitDate: Wed, 22 Apr 2020 00:05:56 +0000 outelf: Fix the section index for the debug output The section information delivered to the debug output has an index of the section table. The index should be different from the total number of sections at the moment, the returned value from add_sectname(). So, fix the value. Fixes: b2004511ddde ("ELF: handle more than 32,633 sections") Reported-by: C. Masloch <pu...@ul...> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392654 Reported-by: <ma...@ou...> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392661 Signed-off-by: Chang S. Bae <cha...@in...> --- output/outelf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/output/outelf.c b/output/outelf.c index 4976b680..18b52d88 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -1108,7 +1108,8 @@ static void elf32_out(int32_t segto, const void *data, /* again some stabs debugging stuff */ sinfo.offset = s->len; - sinfo.section = s->shndx; + /* Adjust to an index of the section table. */ + sinfo.section = s->shndx - 1; sinfo.segto = segto; sinfo.name = s->name; dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo); @@ -1312,7 +1313,8 @@ static void elf64_out(int32_t segto, const void *data, /* again some stabs debugging stuff */ sinfo.offset = s->len; - sinfo.section = s->shndx; + /* Adjust to an index of the section table. */ + sinfo.section = s->shndx - 1; sinfo.segto = segto; sinfo.name = s->name; dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo); @@ -1592,7 +1594,8 @@ static void elfx32_out(int32_t segto, const void *data, /* again some stabs debugging stuff */ sinfo.offset = s->len; - sinfo.section = s->shndx; + /* Adjust to an index of the section table. */ + sinfo.section = s->shndx - 1; sinfo.segto = segto; sinfo.name = s->name; dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo); |