On Tue, Sep 8, 2020 at 2:33 PM Nick Clifton via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Hi Cary, > > If the lto plugin encounters a file with multiple symbol sections, > each of which also has a v1 symbol extension section[1] then it will > attempt to read the extension data for *every* symbol from each of the > extension sections. This results in reading off the end of a buffer > with the associated memory corruption that that entails. > > The attached patch fixes this problem by adding a field to the > plugin_symtab structure which is used to indicate the last symbol that > was updated. Then in parse_symtab_extensions this index is used to > ensure that the correct symbols are updated, in the order read. > > OK to apply ?
OK for all affected branches. Thanks, Richard. > Cheers > Nick > > [1] See the attached file 'j' for an example of this kind of file: > > lto-plugin/ChangeLog > 2020-09-08 Nick Clifton <ni...@redhat.com> > > * lto-plugin.c (struct plugin_symtab): Add last_sym field. > (parse_symtab_extension): Only read as many entries as are > available in the buffer. Store the data read into the symbol > table indexed from last_sym. Increment last_sym. >