php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77184 Unsigned rational numbers are written out as signed rationals
Submitted: 2018-11-21 21:35 UTC Modified: -
From: cmbasnett at gmail dot com Assigned:
Status: Closed Package: EXIF related
PHP Version: 7.3Git-2018-11-21 (Git) OS: macOS Mojave
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cmbasnett at gmail dot com
New email:
PHP Version: OS:

 

 [2018-11-21 21:35 UTC] cmbasnett at gmail dot com
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.


Patches

php-exif-urational-fix (last revision 2018-11-21 21:35 UTC by )

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-26 21:49 UTC] nikic@php.net
Automatic comment on behalf of colin@spexigeo.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9ec519e09499c3f2749e298b097da132f746d4d8
Log: Fixed bug #77184
 [2018-11-26 21:49 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC