| 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 | |||