Bug #80016 [Opn->Fbk]: PHP Warning: exif_thumbnail: Illegal IFD size

From: Date: Tue, 25 Aug 2020 06:32:09 +0000
Subject: Bug #80016 [Opn->Fbk]: PHP Warning: exif_thumbnail: Illegal IFD size
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228746@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80016&edit=1

 ID:                 80016
 Updated by:         cmb@php.net
 Reported by:        7tonin at laposte dot net
 Summary:            PHP Warning:  exif_thumbnail: Illegal IFD size
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            EXIF related
 Operating System:   linux 5.7.14-desktop-1.mga7 x86
 PHP Version:        7.3.21
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> try this file (uploaded twice for free)
> https://file.io/0J2TmIc9gNpR (1w expiry link)
> https://file.io/XFJoy5XoQtd0

Both links give page not found for me.  Could you please check?


Previous Comments:
------------------------------------------------------------------------
[2020-08-24 19:41:23] 7tonin at laposte dot net

Description:
------------
Hi,
while trying to get EXIF thumbnail, some of my crafted pictures (Hugin, Gimp, Imagemagick, Exiftool)
lead my webserver to two warnings:

PHP Warning:  exif_thumbnail(cloud.jpg): Illegal IFD size: 2 + 0x9D00*12 = 0x75C02 > 0x6D78 
PHP Warning:  exif_read_data(cloud.jpg): Illegal IFD size: 2 + 0x9D00*12 = 0x75C02 > 0x6D78

(this is the same size data for any picture)

Another bad thing is file permissions are then changed to apache:apache

Test script:
---------------
try this file (uploaded twice for free)
https://file.io/0J2TmIc9gNpR (1w expiry link)
https://file.io/XFJoy5XoQtd0

Let's call it cloud.jpg

<?php 
$stream = '/path/to/cloud.jpg' ;

if ($exif = exif_read_data($stream, 0, true)) {
    echo "$stream :<br />\n";
    foreach ($exif as $key => $section) {
        foreach ($section as $name => $val) {
            echo "$key.$name : $val<br />\n";
        }
    }
    
    $thumbnail = exif_thumbnail($stream, $width, $height, $type);
    echo "<img  width='$width' height='$height'
src='data:image/gif;base64,".base64_encode($thumbnail)."'>";
}
?>



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80016&edit=1


Thread (9 messages)

« previous php.bugs (#228746) next »