Bug #77184 [NEW]: Unsigned rational numbers are written out as signed rationals
From: cmbasnett at gmail dot com
Operating system: macOS Mojave
PHP version: 7.3Git-2018-11-21 (Git)
Package: EXIF related
Bug Type: Bug
Bug description:Unsigned rational numbers are written out as signed rationals
Description:
------------
I discovered the bug while reading EXIF data from this file:
https://ufile.io/7dx86
The correct value of the GPSLongitude value in DMS format is:
122° 23' 38.1732"
For GPSLongitude, PHP's exif_read_data format returns the following:
array:3 [
0 => "122/1"
1 => "23/1"
2 => "-1622773725/70000000"
]
Note the negative value in there. There should be no negative values
since GPSLongitude is an array of unsigned rationals. As a result, the
value calculated for the seconds component is -23.1824, which is
incorrect.
The problem is that the bytes for the values are being written out as a
signed integer instead of an unsigned integer. The values are being
converted to a string using the wrong format specifier ("%i" instead of
"%u"), so the fix is to simply fix the format specifier.
--
Edit bug report at https://bugs.php.net/bug.php?id=77184&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77184&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77184&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77184&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77184&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77184&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77184&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77184&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77184&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77184&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77184&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77184&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77184&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77184&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77184&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77184&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77184&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77184&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77184&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77184&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77184&r=mysqlcfg
Thread (2 messages)
- cmbasnett at gmail dot com