summaryrefslogtreecommitdiff
path: root/src/image.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-02-19 19:26:14 +0200
committerEli Zaretskii <eliz@gnu.org>2014-02-19 19:26:14 +0200
commitc021382022a9b5d1e61415f219eaa2b31a8c1a29 (patch)
treecab9945d276245bf59dfc687402c8589e8627f8f /src/image.c
parentf097a3d25f77b08548c6d491ddf736ae3d6f58bf (diff)
downloademacs-c021382022a9b5d1e61415f219eaa2b31a8c1a29.tar.gz
Avoid crashes on MS-Windows when JPEG images are too large.
src/image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: If CreateDIBSection returns an error indication, zero out *ximg after destroying the image. This avoids crashes in memory allocations due to the fact that some of the callers also call x_destroy_x_image, which will attempt to free an already free'd block of memory.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c
index e53ad0b4a30..d6d5ace509d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2019,6 +2019,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
XSETINT (errcode, err);
image_error ("Unable to create bitmap, error code %d", errcode, Qnil);
x_destroy_x_image (*ximg);
+ *ximg = NULL;
return 0;
}