Bug #77184 [Opn->Csd]: Unsigned rational numbers are written out as signed rationals

From: Date: Mon, 26 Nov 2018 21:49:58 +0000
Subject: Bug #77184 [Opn->Csd]: Unsigned rational numbers are written out as signed rationals
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218148@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77184&edit=1

 ID:                 77184
 Updated by:         nikic@php.net
 Reported by:        cmbasnett at gmail dot com
 Summary:            Unsigned rational numbers are written out as signed
                     rationals
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            EXIF related
 Operating System:   macOS Mojave
 PHP Version:        7.3Git-2018-11-21 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2018-11-21 21:35:08] 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.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77184&edit=1


Thread (2 messages)

« previous php.bugs (#218148) next »