* dwarf.c (display_debug_frames): Fix range checks to work on
32-bit binaries complied on a 64-bit host.
+ PR binutils/17531
+ * dwarf.c (xcmalloc): Fail if the arguments are too big.
+ (xcrealloc): Likewise.
+ (xcalloc2): Likewise.
+
2015-02-05 Alan Modra <amodra@gmail.com>
PR binutils/17926
{
/* Check for overflow. */
if (nmemb >= ~(size_t) 0 / size)
- return NULL;
+ {
+ fprintf (stderr,
+ _("Attempt to allocate an array with an excessive number of elements: 0x%lx\n"),
+ (long) nmemb);
+ xexit (1);
+ }
return xmalloc (nmemb * size);
}
{
/* Check for overflow. */
if (nmemb >= ~(size_t) 0 / size)
- return NULL;
+ {
+ fprintf (stderr,
+ _("Attempt to re-allocate an array with an excessive number of elements: 0x%lx\n"),
+ (long) nmemb);
+ xexit (1);
+ }
return xrealloc (ptr, nmemb * size);
}
{
/* Check for overflow. */
if (nmemb >= ~(size_t) 0 / size)
- return NULL;
+ {
+ fprintf (stderr,
+ _("Attempt to allocate a zero'ed array with an excessive number of elements: 0x%lx\n"),
+ (long) nmemb);
+ xexit (1);
+ }
return xcalloc (nmemb, size);
}