Bug #79336 [Com]: ext/exif/tests/bug79046.phpt fails on Big endian arch
| From: | vibhutisawant18 at gmail dot com | Date: | Mon, 09 Mar 2020 05:57:40 +0000 |
| Subject: | Bug #79336 [Com]: ext/exif/tests/bug79046.phpt fails on Big endian arch | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225959@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79336&edit=1
ID: 79336
Comment by: vibhutisawant18 at gmail dot com
Reported by: vibhutisawant18 at gmail dot com
Summary: ext/exif/tests/bug79046.phpt fails on Big endian
arch
Status: Open
Type: Bug
Package: EXIF related
Operating System: Ubuntu 16.04
PHP Version: master-Git-2020-03-03 (Git)
Block user comment: N
Private report: N
New Comment:
I added a byte swap in php_ifd_get_float() and php_ifd_get_double(), however same behavior
continues to persist.
Could you please provide with some more insights.
Previous Comments:
------------------------------------------------------------------------
[2020-03-03 10:45:48] nikic@php.net
You likely need to introduce a byte-swap into php_ifd_get_float() and php_ifd_get_double() on
big-endian architectures.
------------------------------------------------------------------------
[2020-03-03 10:40:51] vibhutisawant18 at gmail dot com
Description:
------------
NaN to int cast undefined behavior in exif [ext/exif/tests/bug79046.phpt]
Above TC fails on big endian architecture, the expected value for StripOffsets is NAN whereas that
returned on Big endian is float(8.9143601808023E-41)
Could you please guide us on how to go about it.
PFA test case logs on Little and Big endian Architecture.
Little Endian:
test@a2a9ec71b826:~/php/php-src$ ./sapi/cli/php -f "ext/exif/tests/bug79046.phpt"
--TEST--
Bug #79046: NaN to int cast undefined behavior in exif
--FILE--
array(8) {
["FileDateTime"]=>
int(0)
["FileSize"]=>
int(33)
["FileType"]=>
int(8)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(24) "ANY_TAG, IFD0, THUMBNAIL"
["COMPUTED"]=>
array(2) {
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(1)
}
["StripOffsets"]=>
float(NAN)
["THUMBNAIL"]=>
array(1) {
["StripOffsets"]=>
float(NAN)
}
}
Big endian:
--TEST--
Bug #79046: NaN to int cast undefined behavior in exif
--FILE--
array(8) {
["FileDateTime"]=>
int(0)
["FileSize"]=>
int(33)
["FileType"]=>
int(8)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(24) "ANY_TAG, IFD0, THUMBNAIL"
["COMPUTED"]=>
array(2) {
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(1)
}
["StripOffsets"]=>
float(8.9143601808023E-41)
["THUMBNAIL"]=>
array(1) {
["StripOffsets"]=>
float(8.9143601808023E-41)
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79336&edit=1