Bug #79279 [Opn]: ext/exif/tests/float_cast_overflow.phpt TC fails on Big endian architecture
| From: | vibhutisawant18 at gmail dot com | Date: | Tue, 18 Feb 2020 09:43:30 +0000 |
| Subject: | Bug #79279 [Opn]: ext/exif/tests/float_cast_overflow.phpt TC fails on Big endian architecture | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225611@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79279&edit=1
ID: 79279
User updated by: vibhutisawant18 at gmail dot com
Reported by: vibhutisawant18 at gmail dot com
Summary: ext/exif/tests/float_cast_overflow.phpt TC fails on
Big endian architecture
Status: Open
Type: Bug
Package: *Math Functions
Operating System: Ubuntu 16.04
PHP Version: master-Git-2020-02-18 (Git)
Block user comment: N
Private report: N
New Comment:
I have used imagemagick package to convert float_cast_overflow.tiff image to Big endian format,
however the command failed with below error message:
test@8e9e8232f7f2:~/php/php-src$ convert ext/exif/tests/float_cast_overflow.tiff -define
tiff:endian=msb msb.tif
convert: Sanity check on directory count failed, zero tag directories not supported.
`TIFFFetchDirectory' @ error/tiff.c/TIFFErrors/568.
convert: Failed to read directory at offset 136. `TIFFReadDirectory' @
error/tiff.c/TIFFErrors/568.
convert: no images defined `msb.tif' @ error/convert.c/ConvertImageCommand/3210.
Also,
The File command mentions the direntries=0.
test@8e9e8232f7f2:~/php/php-src$ file ext/exif/tests/float_cast_overflow.tiff
ext/exif/tests/float_cast_overflow.tiff: TIFF image data, little-endian, direntries=0
Previous Comments:
------------------------------------------------------------------------
[2020-02-18 09:23:59] vibhutisawant18 at gmail dot com
Description:
------------
ext/exif/tests/float_cast_overflow.phpt TC fails on Big endian architecture.
The TIFF image used in the Test case is of Little Endian format
test@8e9e8232f7f2:~/php/php-src/ext/exif/tests$ xxd float_cast_overflow.tiff | more
00000000: 4949 2a00 8800 0000 0400 0001 0300 0100 II*.............
00000010: 0000 0100 0000 0101 0b00 0100 0000 0100 ................
00000020: 00f7 0201 0300 00e4 0700 009d 3920 3a35 ............9 :5
00000030: 203a 3533 001d 0010 0005 0000 0080 0020 :53...........
00000040: 2000 0000 0800 0000 0000 0000 0000 0000 ...............
00000050: 0028 1100 0000 0000 0000 0000 0000 0000 .(..............
00000060: 0000 0000 9cff 0000 0000 8000 2020 0000 ............ ..
00000070: e407 0000 9d39 203a 3533 001d 0010 0005 .....9 :53......
00000080: 0000 0080 0020 2000 0000 0800 0000 ..... .......
PFB the test log for ext/exif/tests/float_cast_overflow.phpt on Ubuntu:16.04
test@8e9e8232f7f2:~/php/php-src$ sapi/cli/php ext/exif/tests/float_cast_overflow.phpt
--TEST--
Overflow in float to int cast
--FILE--
array(8) {
["FileName"]=>
string(24) "float_cast_overflow.tiff"
["FileDateTime"]=>
int(1581566800)
["FileSize"]=>
int(142)
["FileType"]=>
int(7)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(24) "ANY_TAG, IFD0, THUMBNAIL"
["COMPUTED"]=>
array(5) {
["html"]=>
string(20) "width="1" height="1""
["Height"]=>
int(1)
["Width"]=>
int(1)
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(0)
}
["THUMBNAIL"]=>
array(2) {
["ImageWidth"]=>
int(1)
["ImageLength"]=>
float(2.3510579257887E-38)
}
}
--EXPECTF--
array(8) {
["FileName"]=>
string(24) "float_cast_overflow.tiff"
["FileDateTime"]=>
int(%d)
["FileSize"]=>
int(142)
["FileType"]=>
int(7)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(24) "ANY_TAG, IFD0, THUMBNAIL"
["COMPUTED"]=>
array(5) {
["html"]=>
string(20) "width="1" height="1""
["Height"]=>
int(1)
["Width"]=>
int(1)
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(0)
}
["THUMBNAIL"]=>
array(2) {
["ImageWidth"]=>
int(1)
["ImageLength"]=>
float(-2.5961487387524E+33)
}
}
The ImagLength returned is
["ImageLength"]=>
float(2.3510579257887E-38)
whereas ImageLength expected is
["ImageLength"]=>
float(-2.5961487387524E+33)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79279&edit=1