From: Richard Biener Date: Thu, 25 Jul 2019 10:50:47 +0000 (+0000) Subject: re PR plugins/90924 (lto-plugin/lto-plugin.c heap memory corruption due to insufficie... X-Git-Tag: releases/gcc-7.5.0~339 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e56430617fe889e589ad78cd67918166f0f9af4;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: r273795 --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index b785e710df35..0ecdec0e4c95 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. + 2018-12-06 Release Manager * GCC 7.4.0 released. diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index a733e4b1a2af..7a25454dbade 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -479,6 +479,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; }