From bea5263502ccdb979e3792cd7c809a017fb8bc91 Mon Sep 17 00:00:00 2001 From: das Date: Tue, 27 Jul 2004 21:19:32 +0000 Subject: * generic/tkImgGIF.c (FileReadGIF): fix crash reported by Reinhard Max: in case of premature end of image data, return error instead of passing nil buffer to Tk_PhotoPutBlock(). --- ChangeLog | 6 ++++++ generic/tkImgGIF.c | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f68deb..13c0749 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-27 Daniel Steffen + + * generic/tkImgGIF.c (FileReadGIF): fix crash reported by Reinhard Max: + in case of premature end of image data, return error instead of + passing nil buffer to Tk_PhotoPutBlock(). + 2004-07-22 Jeff Hobbs * library/tkfbox.tcl (::tk::dialog::file::Update): use -directory diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index c6d04d6..6fe8627 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -29,7 +29,7 @@ * | provided "as is" without express or implied warranty. | * +-------------------------------------------------------------------+ * - * RCS: @(#) $Id: tkImgGIF.c,v 1.25 2003/03/06 15:05:31 dkf Exp $ + * RCS: @(#) $Id: tkImgGIF.c,v 1.26 2004/07/27 21:19:32 das Exp $ */ /* @@ -327,11 +327,12 @@ FileReadGIF(interp, chan, fileName, format, imageHandle, destX, destY, while (1) { if (Fread(buf, 1, 1, chan) != 1) { /* - * Premature end of image. We should really notify - * the user, but for now just show garbage. + * Premature end of image. */ - break; + Tcl_AppendResult(interp,"premature end of image data for this index", + (char *) NULL); + goto error; } if (buf[0] == GIF_TERMINATOR) { -- cgit v0.12