#20907 [Opn]: Failure of the storing Exif tag data elemens after the 2nd

From: Date: Mon, 09 Dec 2002 18:34:18 +0000
Subject: #20907 [Opn]: Failure of the storing Exif tag data elemens after the 2nd
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-27209@lists.php.net to get a copy of this message
ID: 20907 Updated by: iliaa@php.net Reported By: m-arai@sco.bekkoame.ne.jp Status: Open Bug Type: *Graphics related Operating System: FreeBSD 4.6-RELEASE PHP Version: 4.3.0RC2 New Comment: Could you please provide an image that could be used to test this? Previous Comments: ------------------------------------------------------------------------ [2002-12-09 12:31:23] m-arai@sco.bekkoame.ne.jp Addition: The tag number has misplaced in ext/exif/exif.c. --- exif.c.orig Wed Nov 27 11:43:21 2002 +++ exif.c Tue Dec 10 02:45:17 2002 @@ -765,8 +765,8 @@ { 0x0000, "GPSVersion"}, { 0x0001, "GPSLatitudeRef"}, { 0x0002, "GPSLatitude"}, - { 0x0003, "GPSLongitude"}, - { 0x0004, "GPSLongitudeRef"}, + { 0x0003, "GPSLongitudeRef"}, + { 0x0004, "GPSLongitude"}, { 0x0005, "GPSAltitudeRef"}, { 0x0006, "GPSAltitude"}, { 0x0007, "GPSTimeStamp"}, ------------------------------------------------------------------------ [2002-12-09 08:41:13] m-arai@sco.bekkoame.ne.jp ext/exif/exif.c: In exif_iif_add_value() , since the increment of value pointer is not appropriately performed, when length is larger than 1, the elements after 2nd are overwritten by 1st element. ex) GPS.GPSLatitude if the real value of GPSLatitude is "36/1 43859/1000 0/1", $exif = exif_read_data('filename',0,true); $lad = $exif["GPS"]["GPSLatitude"][0]; $lam = $exif["GPS"]["GPSLatitude"][1]; $las = $exif["GPS"]["GPSLatitude"][2]; "$lad,$lam,$las" has to be "36/1 43859/1000 0/1". But, it is set to "36/1 36/1 36/1" in the present. adhoc patch --- ext/exif/exif.c.orig Mon Dec 9 22:01:12 2002 +++ ext/exif/exif.c Mon Dec 9 22:03:10 2002 @@ -1520,6 +1520,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t len gth, void* value, int motorola_intel TSRMLS_DC) { size_t index; + void *vptr; image_info_value *info_value; image_info_data *info_data; image_info_data *list; @@ -1604,35 +1605,36 @@ } else { info_value = &info_data->value; } - for (index=0; index<length; index++) { + /**************/ + for (index=0,vptr=value; index<length; index++, vptr+=php_tiff_bytes_per_format[format]) { if (length>1) { info_value = &info_data->value.list[index]; } switch (format) { case TAG_FMT_USHORT: - info_value->u = php_ifd_get16u(value, motorola_intel); + info_value->u = php_ifd_get16u(vptr, motorola_intel); break; case TAG_FMT_ULONG: - info_value->u = php_ifd_get32u(value, motorola_intel); + info_value->u = php_ifd_get32u(vptr, motorola_intel); break; case TAG_FMT_URATIONAL: - info_value->ur.num = php_ifd_get32u(value, motorola_intel); - info_value->ur.den = php_ifd_get32u(4+(char *)value, motorola_intel); + info_value->ur.num = php_ifd_get32u(vptr, motorola_intel); + info_value->ur.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SSHORT: - info_value->i = php_ifd_get16s(value, motorola_intel); + info_value->i = php_ifd_get16s(vptr, motorola_intel); break; case TAG_FMT_SLONG: - info_value->i = php_ifd_get32s(value, motorola_intel); + info_value->i = php_ifd_get32s(vptr, motorola_intel); break; case TAG_FMT_SRATIONAL: - info_value->sr.num = php_ifd_get32u(value, motorola_intel); - info_value->sr.den = php_ifd_get32u(4+(char *)value, motorola_intel); + info_value->sr.num = php_ifd_get32u(vptr, motorola_intel); + info_value->sr.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SINGLE: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20907&edit=1

« previous php.bugs (#27209) next »