pr21665

Alan Modra amodra@gmail.com
Fri Jun 30 11:26:00 GMT 2017


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



More information about the Binutils mailing list