Subject: Re: bug#14345: 24.3; shr-insert-document crashes gtk-emacs

From: Glenn Morris <[email-masked]>
Date: Tue, 07 May 2013 21:38:28 -0400

Glenn Morris wrote:

> Whoops.

I meant to say:

*** src/image.c	2013-04-07 04:41:19 +0000
--- src/image.c	2013-05-08 01:35:41 +0000
***************
*** 7273,7292 ****
    /* Clear the part of the screen image not covered by the image.
       Full animated GIF support requires more here (see the gif89 spec,
       disposal methods).  Let's simply assume that the part not covered
!      by a sub-image is in the frame's background color.  */
!   for (y = 0; y < img->corners[TOP_CORNER]; ++y)
      for (x = 0; x < width; ++x)
        XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
  
!   for (y = img->corners[BOT_CORNER]; y < height; ++y)
      for (x = 0; x < width; ++x)
        XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
  
!   for (y = img->corners[TOP_CORNER]; y < img->corners[BOT_CORNER]; ++y)
      {
!       for (x = 0; x < img->corners[LEFT_CORNER]; ++x)
  	XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
!       for (x = img->corners[RIGHT_CORNER]; x < width; ++x)
  	XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
      }
  
--- 7273,7297 ----
    /* Clear the part of the screen image not covered by the image.
       Full animated GIF support requires more here (see the gif89 spec,
       disposal methods).  Let's simply assume that the part not covered
!      by a sub-image is in the frame's background color.
! 
!      Note that the corner position can be outside the screen, so take
!      care not to go beyond the screen boundary (bug#14345).
!   */
!   for (y = 0; y < min (height, img->corners[TOP_CORNER]); ++y)
      for (x = 0; x < width; ++x)
        XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
  
!   for (y = max (0, img->corners[BOT_CORNER]); y < height; ++y)
      for (x = 0; x < width; ++x)
        XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
  
!   for (y = max (0, img->corners[TOP_CORNER]);
!        y < min (height, img->corners[BOT_CORNER]); ++y)
      {
!       for (x = 0; x < min (width, img->corners[LEFT_CORNER]); ++x)
  	XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
!       for (x = max (0, img->corners[RIGHT_CORNER]); x < width; ++x)
  	XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
      }