This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [committed, PATCH] Check file size before getting section contents

On 06/27/2017 12:25 AM, H.J. Lu wrote:

>>> The problem is this new "section->filepos + offset + sz"
>>> check here.  GDB calls bfd_get_section_contents with offset != 0,
>>> which causes that "offset + sz" addition to shoot past filesz.
>>> I can't see how that new check makes sense as is.  We're reading
>>> "count" bytes, not "sz" bytes.
>> Please try this:

Sorry, our messages cross paths.  I've already pushed my version
in; it's quite late here, and I wanted to unbreak gdb for the buildbots
and everyone else.  Mine seems like a better check to me, since we're
about to read "count" bytes at "section->filepos + offset" just
after the check, but I don't really know what led to the
original change.  It'd be useful if when when you propose
an alternative, you explain what's wrong with the original, btw.

In any case, the GDB testsuite takes around 5 mins to run
on any modern machine, and the tests that fail are pretty
generic tests that don't really depend on host.  A "make
check" in the gdb dir should work for you.

Pedro Alves

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]