On Sun, 1 Jan 2012 13:25:55 +0100
Robert Pluim <rpluim(a)gmail.com> wrote:
In 21.5, we use an external giflib, so we'd have to move the guts
of
Slurp into our codebase, with the modification you suggest. I'm not
sure how desirable that is.
Ok, here is another idea. I tested with with XEmacs 21.5.31. We change
gif_read_from_memory to handle this specific case:
static int
gif_read_from_memory (GifFileType *gif, GifByteType *buf, int size)
{
gif_memory_storage *mem = (gif_memory_storage *) gif->UserData;
if (size > (mem->len - mem->index)) {
/* Hack to handle a gif file that is missing the terminator byte. */
if (size == 1 && mem->len > 1 && mem->bytes[mem->len - 1]
!= 0x3b) {
*buf = 0x3b;
mem->len = 0;
return 1;
} else
return -1;
}
memcpy (buf, mem->bytes + mem->index, size);
mem->index = mem->index + size;
return size;
}
Since it is short, I added the entire routine. I just added the if
block. Since the UserData is setup once in gif_instantiate and only
used in gif_read_from_memory, it is safe to mess with the len.
I did a quick check to see that it handled the case where the
terminator was missing, but still caught some other random truncations
as errors.
Cheers,
Sean
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta