This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: pr21665
- From: Alan Modra <amodra at gmail dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: Hans-Peter Nilsson <hp at bitrange dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Fri, 30 Jun 2017 20:56:12 +0930
- Subject: Re: pr21665
- Authentication-results: sourceware.org; auth=none
- References: <20170630082308.GE25242@bubble.grove.modra.org> <ab120f7c-a71a-c996-69e2-8bbd2508b82a@redhat.com>
On Fri, Jun 30, 2017 at 11:03:25AM +0100, Nick Clifton wrote:
> +#define MAX_XMALLOC (1024 * 1024 * 1024 * 2UL) /* 2Gb */
> + if (datasize > MAX_XMALLOC)
> + {
> + non_fatal (_("Reading section %s failed because it is too big (%#lx)"),
> + section->name, (unsigned long) datasize);
> + return;
> + }
> +
> data = (bfd_byte *) xmalloc (datasize);
I haven't looked at the bug in detail, but since the testcases are
64-bit, is the problem that on a 32-bit target we're not catching a
size_t overflow?
If so, then
if (datasize != (size_t) datasize)
..
might be a better idea.
--
Alan Modra
Australia Development Lab, IBM