diff options
| author | Kim F. Storm | 2005-09-28 10:48:20 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-09-28 10:48:20 +0000 |
| commit | 0f4aca467ea8f567c03a7d52057b81982661d65b (patch) | |
| tree | 5f4bf84657a18a860ea6749649e44ac1a75da869 /src | |
| parent | 64da575986859110c1acc3deb157525066e5c358 (diff) | |
| download | emacs-0f4aca467ea8f567c03a7d52057b81982661d65b.tar.gz emacs-0f4aca467ea8f567c03a7d52057b81982661d65b.zip | |
(gif_load): Fix size of allocated image buffer
for images where a sub-image may be larger than the image's
total height/width specifications.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/image.c b/src/image.c index 6ec0734e785..bdc78c2d718 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -7369,8 +7369,17 @@ gif_load (f, img) | |||
| 7369 | return 0; | 7369 | return 0; |
| 7370 | } | 7370 | } |
| 7371 | 7371 | ||
| 7372 | width = img->width = max (gif->SWidth, gif->Image.Left + gif->Image.Width); | 7372 | image_top = gif->SavedImages[ino].ImageDesc.Top; |
| 7373 | height = img->height = max (gif->SHeight, gif->Image.Top + gif->Image.Height); | 7373 | image_left = gif->SavedImages[ino].ImageDesc.Left; |
| 7374 | image_width = gif->SavedImages[ino].ImageDesc.Width; | ||
| 7375 | image_height = gif->SavedImages[ino].ImageDesc.Height; | ||
| 7376 | |||
| 7377 | width = img->width = max (gif->SWidth, | ||
| 7378 | max (gif->Image.Left + gif->Image.Width, | ||
| 7379 | image_left + image_width)); | ||
| 7380 | height = img->height = max (gif->SHeight, | ||
| 7381 | max (gif->Image.Top + gif->Image.Height, | ||
| 7382 | image_top + image_height)); | ||
| 7374 | 7383 | ||
| 7375 | /* Create the X image and pixmap. */ | 7384 | /* Create the X image and pixmap. */ |
| 7376 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | 7385 | if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
| @@ -7405,11 +7414,6 @@ gif_load (f, img) | |||
| 7405 | requires more than can be done here (see the gif89 spec, | 7414 | requires more than can be done here (see the gif89 spec, |
| 7406 | disposal methods). Let's simply assume that the part | 7415 | disposal methods). Let's simply assume that the part |
| 7407 | not covered by a sub-image is in the frame's background color. */ | 7416 | not covered by a sub-image is in the frame's background color. */ |
| 7408 | image_top = gif->SavedImages[ino].ImageDesc.Top; | ||
| 7409 | image_left = gif->SavedImages[ino].ImageDesc.Left; | ||
| 7410 | image_width = gif->SavedImages[ino].ImageDesc.Width; | ||
| 7411 | image_height = gif->SavedImages[ino].ImageDesc.Height; | ||
| 7412 | |||
| 7413 | for (y = 0; y < image_top; ++y) | 7417 | for (y = 0; y < image_top; ++y) |
| 7414 | for (x = 0; x < width; ++x) | 7418 | for (x = 0; x < width; ++x) |
| 7415 | XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); | 7419 | XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |