com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/gd/libgd/ gd_gif_in.c ext/phar/stub.h
| From: | Stanislav Malyshev | Date: | Tue, 02 Jan 2018 04:28:01 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/gd/libgd/ gd_gif_in.c ext/phar/stub.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100728@lists.php.net to get a copy of this message | ||
Commit: 459ab2eef49a754ef7553266ad34991317df3c91
Author: Stanislav Malyshev <stas@php.net> Mon, 1 Jan 2018 20:28:01 -0800
Parents: e19c71e3d592b47dc25b2523a0200a4c5097ceab 2881199c804d3cb11dd449ad10fa3965549812ea
Branches: PHP-7.0 PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=459ab2eef49a754ef7553266ad34991317df3c91
Log:
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5..6:
Update NEWS
Fixed bug #75571: Potential infinite loop in gdImageCreateFromGifCtx
Fix bug #74782: remove file name from output to avoid XSS
Bugs:
https://bugs.php.net/75571
https://bugs.php.net/74782
Changed paths:
MM ext/gd/libgd/gd_gif_in.c
MM ext/phar/stub..h
Diff:
diff --cc ext/phar/stub.h
index 710dee6,1edbb06..71545c9
--- a/ext/phar/stub.h
+++ b/ext/phar/stub.h
@@@ -28,7 -28,7 +28,7 @@@ static inline zend_string* phar_get_stu
static const char newstub3_1[] = "ART;\n}\n}\n\nstatic function tmpdir()\n{\nif
(strpos(PHP_OS, 'WIN') !== false) {\nif ($var = getenv('TMP') ?
getenv('TMP') : getenv('TEMP')) {\nreturn $var;\n}\nif
(is_dir('/temp') || mkdir('/temp')) {\nreturn
realpath('/temp');\n}\nreturn false;\n}\nif ($var = getenv('TMPDIR')) {\nreturn
$var;\n}\nreturn realpath('/tmp');\n}\n\nstatic function _unpack($m)\n{\n$info =
unpack('V', substr($m, 0, 4));\n $l = unpack('V', substr($m, 10, 4));\n$m =
substr($m, 14 + $l[1]);\n$s = unpack('V', substr($m, 0, 4));\n$o = 0;\n$start = 4 +
$s[1];\n$ret['c'] = 0;\n\nfor ($i = 0; $i < $info[1]; $i++) {\n $len =
unpack('V', substr($m, $start, 4));\n$start += 4;\n $savepath = substr($m, $start,
$len[1]);\n$start += $len[1];\n $ret['m'][$savepath] =
array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start,
24)));\n$ret['m'][$savepath][3] = sprintf('%u',
$ret['m'][$savepath][3]\n& 0xffffffff);\n$ret['m'][$savepath][7] = $o;\n$o
+= $ret['m'][$savepath][2];\n$start += 24 +
$ret['m'][$savepath][5];\n$ret['c'] |= $ret['m'][$savepath][4] &
self::MASK;\n}\nreturn $ret;\n}\n\nstatic function extractFile($path, $entry, $fp)\n{\n$data =
'';\n$c = $entry[2];\n\nwhile ($c) {\nif ($c < 8192) {\n$data .= @fread($fp, $c);\n$c =
0;\n} else {\n$c -= 8192;\n$data .= @fread($fp, 8192);\n}\n}\n\nif ($entry[4] & self::GZ)
{\n$data = gzinflate($data);\n} elseif ($entry[4] & self::BZ2) {\n$data =
bzdecompress($data);\n}\n\nif (strlen($data) != $entry[0]) {\ndie(\"Invalid internal .phar file
(size error \" . strlen($data) . \" != \" .\n$stat[7] . \")\");\n}\n\nif
($entry[3] != sprintf(\"%u\", crc32((binary)$data) & 0xffffffff))
{\ndie(\"Invalid internal .phar file (checksum error)\");\n}\n\nreturn $data;\n}\n\nstatic
function _removeTmpFiles($temp, $origdir)\n{\nchdir($temp);\n\nforeach (glob('*') as $f)
{\nif (file_exists($f)) {\nis_dir($f) ? @rmdir($f) : @unlink($f);\nif (file_exists($f) &&
is_dir($f)) {\nself::_removeTmpFiles($f,
getcwd());\n}\n}\n}\n\n@rmdir($temp);\nclearstatcache();\nchdir($origdir);\n}\n}\n\nExtract_Phar::go();\n__HALT_COMPIL";
static const char newstub3_2[] = "ER(); ?>";
- static const int newstub_len = 6665;
+ static const int newstub_len = 6655;
- *len = spprintf(stub, name_len + web_len + newstub_len, "%s%s%s%s%s%s%d%s%s%s",
newstub0, web, newstub1_0, newstub1_1, index_php, newstub2, name_len + web_len + newstub_len,
newstub3_0, newstub3_1, newstub3_2);
+ return strpprintf(name_len + web_len + newstub_len, "%s%s%s%s%s%s%d%s%s%s", newstub0,
web, newstub1_0, newstub1_1, index_php, newstub2, name_len + web_len + newstub_len, newstub3_0,
newstub3_1, newstub3_2);
}