From: Richard Biener Date: Thu, 25 Jul 2019 10:46:54 +0000 (+0000) Subject: re PR plugins/90924 (lto-plugin/lto-plugin.c heap memory corruption due to insufficie... X-Git-Tag: releases/gcc-9.2.0~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=daa31aea3049ebff072ecced5dcfe6d158539973;p=thirdparty%2Fgcc.git re PR plugins/90924 (lto-plugin/lto-plugin.c heap memory corruption due to insufficient sanitization.) 2019-07-25 Richard Biener PR lto/90924 Backport from mainline 2019-07-12 Ren Kimura * simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx. From-SVN: r273793 --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 51f8edf0bf20..e049fc9b9bd0 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,12 @@ +2019-07-25 Richard Biener + + PR lto/90924 + Backport from mainline + 2019-07-12 Ren Kimura + + * simple-object-elf.c (simple_object_elf_match): Check zero value + shstrndx. + 2019-05-03 Release Manager * GCC 9.1.0 released. diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index 22c9ae7ed2df..3d49f339631c 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -549,6 +549,14 @@ simple_object_elf_match (unsigned char header[SIMPLE_OBJECT_MATCH_HEADER_LEN], return NULL; } + if (eor->shstrndx == 0) + { + *errmsg = "invalid ELF shstrndx == 0"; + *err = 0; + XDELETE (eor); + return NULL; + } + return (void *) eor; }