Tk Source Code

View Ticket
Login
Ticket UUID: 4da2191b02af0121223d3aadc4dbeedb60d1fbf5
Title: gif read code may not detect 2nd image
Type: Bug Version: 8.6.9
Submitter: oehhar Created on: 2019-02-03 10:53:13
Subsystem: 42. Photo Image|GIF Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2019-03-04 18:39:42
Resolution: Fixed Closed By: oehhar
    Closed on: 2019-03-04 18:39:42
Description:

The gif read code may not read an image until its end. This was observed with the image in test "imgPhoto-14.4" which is obviously a special image with a buffer overflow.

This is not critical, if it is the last image. It is critical, if an image is skipped due to an -index argument.

A test image showing this issue was crafted as follows:

  • Take the image from test imgPhoto-14.4 This does not read the following bytes from the image data: 01 (length) 04 (data) 00 (block terminator)
  • The upper byte 04 (data) was replaced by "3b", which is the file terminator.
  • Add after the image data a 2nd image: (Ext) 64 00 03 00 (Image 4x4) 2c 00 00 00 00 04 00 04 00 00 03 04 28 ba dc 92 00

The resulting image works well in Irvanview, but the image with -index 1 may not be found:

% image create photo I -file test_14.1_end_3b_plus_I.gif -format "gif -index 1"
no image data for this index

The fix is to read the image data until the end. This will happen in a branch of "core-8-6-branch" named "bug-xxx". I would appreciate if someone could review it and merge it to the appropriate branch. I am very new to tk C programming...

User Comments: oehhar added on 2019-03-04 18:39:42:

Merged to core-8-6-branch by commit [5b17bc40].


oehhar added on 2019-02-03 11:26:51:

The patch for this issue including a test described in the ticked was committed with commit [682c7f7f] in branch [bug-4da2191b].

I think this patch is suitable for core-8-6-branch and trunk.

Thank you, Harald


Attachments: