Skip to content

Commit

Permalink
Merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
oehhar committed Jun 18, 2024
2 parents 4e38955 + 648320e commit dab36e2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
8 changes: 7 additions & 1 deletion generic/tkImgGIF.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,13 @@ FileReadGIF(
*/

if (Fread(gifConfPtr, buf, 1, 3, chan) != 3) {
return TCL_OK;
/*
* Bug [865af0148c]: 3 bytes should be there, but data ended before
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"GIF file truncated", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "TRUNCATED", NULL);
return TCL_ERROR;
}
bitPixel = 2 << (buf[0] & 0x07);

Expand Down
Binary file added tests/corruptTruncatedColormap.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions tests/imgPhoto.test
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,23 @@ test imgPhoto-20.6 {Reject truncated GIF (file)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
test imgPhoto-20.6.1 {Reject truncated GIF in Colormap - ticket 865af0148c - file} -setup {
set fileName [file join [file dirname [info script]] corruptTruncatedColormap.gif]
} -body {
image create photo gif1 -file $fileName
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {GIF file truncated}
test imgPhoto-20.6.2 {Reject truncated GIF in Colormap - ticket 865af0148c - data} -setup {
set fileName [file join [file dirname [info script]] corruptTruncatedColormap.gif]
set h [open $fileName rb]
set d [read $h]
close $h
} -body {
image create photo gif1 -data $d
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {GIF file truncated}
test imgPhoto-20.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
nonPortable
} -setup {
Expand Down

0 comments on commit dab36e2

Please sign in to comment.