__malloc_ptrdiff_t, fail right away.
+2001-04-09 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * gmalloc.c (align): If the argument SIZE would overflow
+ __malloc_ptrdiff_t, fail right away.
+
2001-04-06 Gerd Moellmann <gerd@gnu.org>
* xfns.c (compute_tip_xy): Add parameters WIDTH and HEIGHT.
__ptr_t result;
unsigned long int adj;
- result = (*__morecore) (size);
+ /* align accepts an unsigned argument, but __morecore accepts a
+ signed one. This could lead to trouble if SIZE overflows a
+ signed int type accepted by __morecore. We just punt in that
+ case, since they are requesting a ludicrous amount anyway. */
+ if ((__malloc_ptrdiff_t)size < 0)
+ result = 0;
+ else
+ result = (*__morecore) (size);
adj = (unsigned long int) ((unsigned long int) ((char *) result -
(char *) NULL)) % BLOCKSIZE;
if (adj != 0)