Bug #80016 [NEW]: PHP Warning: exif_thumbnail: Illegal IFD size

From: Date: Mon, 24 Aug 2020 19:41:24 +0000
Subject: Bug #80016 [NEW]: PHP Warning: exif_thumbnail: Illegal IFD size
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228744@lists.php.net to get a copy of this message
From:             7tonin at laposte dot net
Operating system: linux 5.7.14-desktop-1.mga7 x86
PHP version:      7.3.21
Package:          EXIF related
Bug Type:         Bug
Bug description:PHP Warning:  exif_thumbnail: Illegal IFD size

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 bug report at https://bugs.php.net/bug.php?id=80016&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80016&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80016&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80016&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80016&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80016&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80016&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80016&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80016&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80016&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80016&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80016&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80016&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80016&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80016&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80016&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80016&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80016&r=mysqlcfg


Thread (9 messages)

« previous php.bugs (#228744) next »