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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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 )

Pull Requests

Pull requests:

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: Thu Dec 05 01:01:30 2024 UTC