Merge branch 'PHP-5.6'

* PHP-5.6:
  Fix #70096: Repeated iptcembed() adds superfluous FF bytes

Conflicts:
	ext/standard/iptc.c
This commit is contained in:
Christoph M. Becker 2015-07-18 22:52:39 +02:00
commit 3ed0d18152
2 changed files with 32 additions and 0 deletions

View File

@ -238,6 +238,7 @@ PHP_FUNCTION(iptcembed)
case M_APP13:
/* we are going to write a new APP13 marker, so don't output the old one */
php_iptc_skip_variable(fp, 0, 0);
fgetc(fp); /* skip already copied 0xFF byte */
php_iptc_read_remaining(fp, spool, poi?&poi:0);
done = 1;
break;

View File

@ -0,0 +1,31 @@
--TEST--
Bug #70096 (Repeated iptcembed() adds superfluous FF bytes)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$filename = __DIR__ . '/bug70096.jpg';
$im = imagecreatetruecolor(10, 10);
imagejpeg($im, $filename);
imagedestroy($im);
$data = "\x1C\x02x\x00\x0ATest image"
. "\x1C\x02t\x00\x22Copyright 2008-2009, The PHP Group";
$content1 = iptcembed($data, $filename);
$fp = fopen($filename, "wb");
fwrite($fp, $content1);
fclose($fp);
$content2 = iptcembed($data, $filename);
$fp = fopen($filename, "wb");
fwrite($fp, $content2);
fclose($fp);
var_dump($content1 === $content2);
?>
--CLEAN--
<?php
$filename = __DIR__ . '/bug70096.jpg';
@unlink($filename);
?>
--EXPECT--
bool(true)