Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: 97f025c152122dca279cd7dd09b9ae952d0ca97a
Ticket: 10f2e7872bc0f8d81fa0f3596afeb0f4cf1191a1
PNg writer produces invalid files
User & Date: fpigorsch 2016-10-17 14:28:52
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/html"
  4. comment changed to:
    Starting in Tk 8.6.5, the following code snippet produces an invalid PNG file:
    
    <pre>
    ########
    # create image (large dimensions seem to trigger the bug)
    set width 2000
    set height 5000
    set img [image create photo -width $width -height $height]
    
    # create row of random RGB pixels (a high number of different colors seems to be requirement for the bug)
    set row {}
    for {set x 0} {$x < $width} {incr x} {
        set c [format "#%02X%02X%02X" [expr int(rand() * 256)] [expr int(rand() * 256)] [expr int(rand() * 256)]]
        lappend row $c
    }
    set row [list $row]
    
    # fill image with 'row'
    for {set y 0} {$y < $height} {incr y} {
        $img put $row -to 0 $y $width [expr {$y + 1}]
    }
    
    # write png
    set fname /tmp/invalid.png
    $img write -format png $fname
    
    exit
    ########
    </pre>
    
    
    Loading /tmp/invalid.png with a libpng-based app (e.g. pngtopnm), results in several error messages, such as
    
    <pre>
    ...
    libpng warning: Ignoring bad adaptive filter type
    libpng warning: Ignoring bad adaptive filter type
    pnmtopng:  fatal libpng error: Extra compressed data
    pngtopnm: setjmp returns error condition
    </pre>
    
  5. foundin changed to: "8.6.6, 8.6.5"
  6. is_private changed to: "0"
  7. login: "fpigorsch"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "ecd5642cbe51a82be8aa1993eeaafe0441ea8139"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "fpigorsch"
  14. subsystem changed to: "41. Photo Images"
  15. title changed to: "PNg writer produces invalid files"
  16. type changed to: "Bug"