aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorPaul Eggert2011-06-22 17:46:41 -0700
committerPaul Eggert2011-06-22 17:46:41 -0700
commit7fcccf1efe3d4bc6182253ec0b1b5fd409fdd242 (patch)
treef84f3e5c3952e08e69ffcd23a29bf44b38438495 /src/image.c
parent39019e542536660936a5fd1a7369ae54fdc6ddd2 (diff)
downloademacs-7fcccf1efe3d4bc6182253ec0b1b5fd409fdd242.tar.gz
emacs-7fcccf1efe3d4bc6182253ec0b1b5fd409fdd242.zip
* image.c (cache_image): Check for size arithmetic overflow.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c
index a9785e5d00f..6e8440fb431 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1836,6 +1836,8 @@ cache_image (struct frame *f, struct image *img)
1836 /* If no free slot found, maybe enlarge c->images. */ 1836 /* If no free slot found, maybe enlarge c->images. */
1837 if (i == c->used && c->used == c->size) 1837 if (i == c->used && c->used == c->size)
1838 { 1838 {
1839 if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *c->images / 2 < c->size)
1840 memory_full (SIZE_MAX);
1839 c->size *= 2; 1841 c->size *= 2;
1840 c->images = (struct image **) xrealloc (c->images, 1842 c->images = (struct image **) xrealloc (c->images,
1841 c->size * sizeof *c->images); 1843 c->size * sizeof *c->images);