mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
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:
commit
3ed0d18152
@ -238,6 +238,7 @@ PHP_FUNCTION(iptcembed)
|
|||||||
case M_APP13:
|
case M_APP13:
|
||||||
/* we are going to write a new APP13 marker, so don't output the old one */
|
/* we are going to write a new APP13 marker, so don't output the old one */
|
||||||
php_iptc_skip_variable(fp, 0, 0);
|
php_iptc_skip_variable(fp, 0, 0);
|
||||||
|
fgetc(fp); /* skip already copied 0xFF byte */
|
||||||
php_iptc_read_remaining(fp, spool, poi?&poi:0);
|
php_iptc_read_remaining(fp, spool, poi?&poi:0);
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
|
31
ext/standard/tests/image/bug70096.phpt
Normal file
31
ext/standard/tests/image/bug70096.phpt
Normal 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)
|
Loading…
Reference in New Issue
Block a user