1
0
mirror of https://github.com/php/php-src.git synced 2026-04-05 15:12:39 +02:00

MFH: fix #40109 (iptcembed fails on non-jfif jpegs)

This commit is contained in:
Antony Dovgal
2007-02-12 20:30:52 +00:00
parent 634615cd42
commit 511463854b
2 changed files with 11 additions and 1 deletions

1
NEWS
View File

@@ -9,6 +9,7 @@ PHP NEWS
methods). (Tony)
- Fixed bug #40428 (imagepstext() doesn't accept optional parameter). (Pierre)
- Fixed bug #40410 (ext/posix does not compile on MacOS 10.3.9). (Tony)
- Fixed bug #40109 (iptcembed fails on non-jfif jpegs). (Tony)
- Fixed bug #39836 (SplObjectStorage empty after unserialize). (Marcus)
08 Feb 2007, PHP 5.2.1

View File

@@ -183,6 +183,7 @@ PHP_FUNCTION(iptcembed)
unsigned int spool = 0, done = 0, inx, len;
unsigned char *spoolbuf=0, *poi=0;
struct stat sb;
zend_bool written = 0;
switch(ZEND_NUM_ARGS()){
case 3:
@@ -226,7 +227,8 @@ PHP_FUNCTION(iptcembed)
if (spool < 2) {
fstat(fileno(fp), &sb);
poi = spoolbuf = emalloc(len + sizeof(psheader) + sb.st_size + 1024);
poi = spoolbuf = safe_emalloc(1, len + sizeof(psheader) + sb.st_size + 1024, 1);
memset(poi, 0, len + sizeof(psheader) + sb.st_size + 1024 + 1);
}
if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xFF) {
@@ -264,6 +266,13 @@ PHP_FUNCTION(iptcembed)
case M_APP0:
/* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */
case M_APP1:
if (written) {
/* don't try to write the data twice */
break;
}
written = 1;
php_iptc_skip_variable(fp, spool, poi?&poi:0 TSRMLS_CC);
if (len & 1) len++; /* make the length even */