Tcl Library Source Code

View Ticket
Login
Ticket UUID: 2055837
Title: Bad InteropIFD directory causes crash
Type: Bug Version: None
Submitter: nobody Created on: 2008-08-17 12:24:47
Subsystem: jpeg Assigned To: afaupell
Priority: 5 Medium Severity:
Status: Open Last Modified: 2026-11-16 00:06:14
Resolution: None Closed By:
    Closed on:
Description:
Some of my images crash the GetExif function with the following error:

---------------------------
Error in startup script
---------------------------
expected integer but got ""
    while executing
"format %u $value"
    ("4" arm line 3)
    invoked from within
"switch -exact -- $type {
        1 { _scan $end $value c value }
        2 { set value [string trimright $value \x00] }
        3 {
            _scan ..."
    (procedure "_format" line 11)
    invoked from within
"_format $end [string range $value [expr {$len * $i}] [expr {($len * $i) + $len - 1}]] $type 1"
    (procedure "_format" line 7)
    invoked from within
"_format $byteOrder $value $format $components"
    (procedure "_exif" line 35)
    invoked from within
"_exif $fh $byteOrder $offset"
    (procedure "_exif" line 19)
    invoked from within
"_exif $fh $byteOrder $offset"
    (procedure "_exif" line 19)
    invoked from within
"_exif $fh $byteOrder $start"
    (procedure "::jpeg::getExif" line 28)
    invoked from within
"::jpeg::getExif "CIMG0049.JPG" "
    invoked from within
"set t [ ::jpeg::getExif "CIMG0049.JPG" ]"
     ...
---------------------------
OK   
---------------------------

The camera is
Make : CASIO COMPUTER CO.,LTD 
Model : QV-R41 
Software : 1.00                 

exiftool 7.30 reports a warning "Bad InteropIFD directory".

I added a length check as a hot fix:

             seek $fh $pos start
         }
+        if { $size > [ string length $value ] } continue
         lappend return $tag [_format $byteOrder $value $format $components]
     }
     return $return

The actual problem is a bad pointer to the InteropIFD directory. Therefore,
a more general solution would be something like black list checking.

Are there any plans in this direction? I am going to implement one as
a work around for my own but may also post it as a proposal.
User Comments: serhiy.storchaka added on 2026-11-16 00:06:14:

Proposed fix in branch jpeg-bad-exif-offsets: Exif entries whose offsets point outside the data are skipped instead of raising an error. Tests jpeg-43.0 and jpeg-43.1.