From: Martin Liska Date: Wed, 24 Jul 2019 07:00:48 +0000 (+0200) Subject: Fix off-by-one in simple-object-elf.c (PR lto/91228). X-Git-Tag: misc/cutover-git~3819 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70121844349587b23c3950e844021a22ab51638c;p=thirdparty%2Fgcc.git Fix off-by-one in simple-object-elf.c (PR lto/91228). 2019-07-24 Martin Liska PR lto/91228 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Find first '\0' starting from gnu_lto + 1. From-SVN: r273757 --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index ddd96183e010..c22d49f157a3 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2019-07-24 Martin Liska + + PR lto/91228 + * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): + Find first '\0' starting from gnu_lto + 1. + 2019-07-12 Ren Kimura * simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx. diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index bdee963634d6..751592665969 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -1388,8 +1388,8 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, (unsigned char *)strings, strsz, &errmsg, err); /* Find first '\0' in strings. */ - gnu_lto = (char *) memchr (gnu_lto, '\0', - strings + strsz - gnu_lto + 1); + gnu_lto = (char *) memchr (gnu_lto + 1, '\0', + strings + strsz - gnu_lto); /* Read the section index table if present. */ if (symtab_indices_shndx[i - 1] != 0) {