Tk Source Code

View Ticket
Login
2024-06-18
08:45 Closed ticket [865af0148c]: Endless loop reading corrupt GIF image plus 7 other changes artifact: eb0c8471f6 user: oehhar
08:30
Ticket [865af014]: add error message on corrupt gif file check-in: fc6f736921 user: oehhar tags: core-8-6-branch
2024-06-14
18:05 Ticket [865af0148c] Endless loop reading corrupt GIF image status still Open with 3 other changes artifact: 9c962ac526 user: obermeier
10:40 Ticket [865af0148c]: 4 changes artifact: ee401b5628 user: oehhar
10:38
Ticket [865af0148c] GIF errornously accepted if colormap segment is truncated check-in: 5a0a931195 user: oehhar tags: bug-865af0148c-gif-truncated-colormap
2024-06-13
19:51 Ticket [865af0148c] Endless loop reading corrupt GIF image status still Open with 4 other changes artifact: c92f63e5d4 user: oehhar
19:44 Ticket [865af0148c]: 3 changes artifact: e64427d215 user: obermeier
19:32 Ticket [865af0148c]: 4 changes artifact: a34403384d user: oehhar
19:23 Ticket [865af0148c]: 3 changes artifact: d4e9b45a7f user: obermeier
19:05 Ticket [865af0148c]: 3 changes artifact: 3c790d9fe1 user: oehhar
19:05 Ticket [865af0148c]: 4 changes artifact: 08f3ba202d user: oehhar
18:59 Add attachment e34116d68f49c7852b362ec72a636df5.gif to ticket [865af0148c] artifact: 31e97b5926 user: obermeier
18:59 Add attachment GetNumImgs.tcl to ticket [865af0148c] artifact: 11b74f7734 user: obermeier
18:58 New ticket [865af0148c] Endless loop reading corrupt GIF image. artifact: d0b088d467 user: obermeier

Ticket UUID: 865af0148c7c5202f71db286a77713c0b4e6adf8
Title: Endless loop reading corrupt GIF image
Type: Bug Version: 8.6, 8.7, 9.0
Submitter: obermeier Created on: 2024-06-13 18:58:50
Subsystem: 42. Photo Image|GIF Assigned To: oehhar
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2024-06-18 08:45:37
Resolution: Fixed Closed By: oehhar
    Closed on: 2024-06-18 08:45:37
Description:
The attached script tries to retrieve the number of images (pages) contained in a GIF file. 
The image is corrupted and part of the image test suite at https://code.google.com/archive/p/imagetestsuite/downloads.
The -index command does not return an error, so the script runs endless.

Note: If using the img::gif extension, the script works correctly.
User Comments: oehhar added on 2024-06-18 08:45:37:

Merged to all branched starting with commit [fc6f7369].

Thanks again ! Harald


obermeier added on 2024-06-14 18:05:39:
Commit looks fine.
Change should also be applied to 8.6 and 8.7.

oehhar added on 2024-06-14 10:40:22:

Good catch and good solution, thank you, Paul, I appreciate!

What do you think of commit [5a0a931195ecf2dd] ?

Any other opinions?

I will merge next week, if ok.

Thank you and take care, Harald


oehhar added on 2024-06-13 19:51:47:

Yes, but I fear that was by intention. There shouldn't be any errors if an image was well shown.

Anyway, will look into it tomorrow.

Thanks for all, Harald


obermeier added on 2024-06-13 19:44:28:
I do not think, you have to blame yourself.
The (wrong) return value TCL_OK can be found in Tk 4.2, the eldest Tk version I found on my computer :-)

oehhar added on 2024-06-13 19:32:39:

Yes, I remember, that I was aksed to be tolerant againt errornous data, if it is not related to the current image. We may check this.

Thanks a lot for the light-speed solution !

Take care, Harald


obermeier added on 2024-06-13 19:23:51:
After comparing with Img, it seems the problem is in the following lines:

if (Fread(gifConfPtr, buf, 1, 3, chan) != 3) {
    return TCL_OK;
}

Changing these lines to:

if (Fread(gifConfPtr, buf, 1, 3, chan) != 3) {
    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
        "Inconsistent encoding in file \"%s\"", fileName));
    Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "ENCODING", NULL);
    return TCL_ERROR;
}

corrects the problem.

oehhar added on 2024-06-13 19:05:17:

Blame probably me for that. I will have a look probably tomorrow.

Sorry, Harald


Attachments: