1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-15 04:11:53 -08:00

* image.c (cache_image): Check for size arithmetic overflow.

This commit is contained in:
Paul Eggert 2011-06-22 17:46:41 -07:00
parent 39019e5425
commit 7fcccf1efe
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2011-06-23 Paul Eggert <eggert@cs.ucla.edu>
* image.c (cache_image): Check for size arithmetic overflow.
2011-06-22 Paul Eggert <eggert@cs.ucla.edu>
* lread.c: Integer overflow issues.

View file

@ -1836,6 +1836,8 @@ cache_image (struct frame *f, struct image *img)
/* If no free slot found, maybe enlarge c->images. */
if (i == c->used && c->used == c->size)
{
if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *c->images / 2 < c->size)
memory_full (SIZE_MAX);
c->size *= 2;
c->images = (struct image **) xrealloc (c->images,
c->size * sizeof *c->images);