diff options
| author | Eli Zaretskii | 2014-02-19 19:26:14 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2014-02-19 19:26:14 +0200 |
| commit | c021382022a9b5d1e61415f219eaa2b31a8c1a29 (patch) | |
| tree | cab9945d276245bf59dfc687402c8589e8627f8f /src | |
| parent | f097a3d25f77b08548c6d491ddf736ae3d6f58bf (diff) | |
| download | emacs-c021382022a9b5d1e61415f219eaa2b31a8c1a29.tar.gz emacs-c021382022a9b5d1e61415f219eaa2b31a8c1a29.zip | |
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')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/image.c | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0fc12fce809..cbc48a75469 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-02-19 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: If | ||
| 4 | CreateDIBSection returns an error indication, zero out *ximg after | ||
| 5 | destroying the image. This avoids crashes in memory allocations | ||
| 6 | due to the fact that some of the callers also call | ||
| 7 | x_destroy_x_image, which will attempt to free an already free'd | ||
| 8 | block of memory. | ||
| 9 | |||
| 1 | 2014-02-18 Martin Rudalics <rudalics@gmx.at> | 10 | 2014-02-18 Martin Rudalics <rudalics@gmx.at> |
| 2 | 11 | ||
| 3 | * widget.c (update_various_frame_slots): Don't set | 12 | * widget.c (update_various_frame_slots): Don't set |
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, | |||
| 2019 | XSETINT (errcode, err); | 2019 | XSETINT (errcode, err); |
| 2020 | image_error ("Unable to create bitmap, error code %d", errcode, Qnil); | 2020 | image_error ("Unable to create bitmap, error code %d", errcode, Qnil); |
| 2021 | x_destroy_x_image (*ximg); | 2021 | x_destroy_x_image (*ximg); |
| 2022 | *ximg = NULL; | ||
| 2022 | return 0; | 2023 | return 0; |
| 2023 | } | 2024 | } |
| 2024 | 2025 | ||