mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 11:10:49 +00:00
Compare commits
122
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a3e6f7100 | ||
|
|
028507f1f6 | ||
|
|
2881199c80 | ||
|
|
8d6e958867 | ||
|
|
73ca9b3773 | ||
|
|
f6e8ce8121 | ||
|
|
f600785f65 | ||
|
|
ad7ed6fe21 | ||
|
|
787e3a1ee4 | ||
|
|
9839d3a953 | ||
|
|
45ac5edbd9 | ||
|
|
7d06a5c89f | ||
|
|
37acebcc8c | ||
|
|
a7815e63bd | ||
|
|
d37658be6c | ||
|
|
390f64701d | ||
|
|
7991a88675 | ||
|
|
55b880070c | ||
|
|
703be4f77e | ||
|
|
27a743b82b | ||
|
|
bdf7393ddb | ||
|
|
2693e52113 | ||
|
|
4e68b2c52b | ||
|
|
f269cdcd4f | ||
|
|
e46d589624 | ||
|
|
12107d619b | ||
|
|
f7f4fd4706 | ||
|
|
e8b7698f5e | ||
|
|
2aae60461c | ||
|
|
f8c514ba6b | ||
|
|
8dc4f4dc9e | ||
|
|
5f8380d33e | ||
|
|
89637c6b41 | ||
|
|
3eecee16d1 | ||
|
|
0f8cf3b849 | ||
|
|
0e21d8066b | ||
|
|
cf649f59cb | ||
|
|
d2274b01cb | ||
|
|
f1b2afc9d9 | ||
|
|
6477bb724e | ||
|
|
50b38322b9 | ||
|
|
814966ad33 | ||
|
|
0ab1af7d3e | ||
|
|
ad9c552b12 | ||
|
|
7e49e8e797 | ||
|
|
db890956ec | ||
|
|
3b14d7b84b | ||
|
|
900b17b15f | ||
|
|
f697874e3f | ||
|
|
0426b916df | ||
|
|
fa2125df67 | ||
|
|
a65ad951ad | ||
|
|
1cda0d7c2f | ||
|
|
e5246580a8 | ||
|
|
16b3003ffc | ||
|
|
b28b8b2fee | ||
|
|
ca46d0acbc | ||
|
|
2ba3b27594 | ||
|
|
79e47aae41 | ||
|
|
0c9324ea9b | ||
|
|
60da307c61 | ||
|
|
c89306ac52 | ||
|
|
b04d60626d | ||
|
|
d7ce944cf1 | ||
|
|
266ecb6d0a | ||
|
|
cf2496140d | ||
|
|
1cd566e13f | ||
|
|
c8778eb293 | ||
|
|
36d02a36ae | ||
|
|
8856b3a63c | ||
|
|
5049ef2f1c | ||
|
|
2a80758fd5 | ||
|
|
28cf42568b | ||
|
|
114277ed45 | ||
|
|
bc85678df3 | ||
|
|
7f529e3dee | ||
|
|
6785ea2340 | ||
|
|
e715dafae0 | ||
|
|
2d19c92fc2 | ||
|
|
f0f68c7274 | ||
|
|
9befad6fc2 | ||
|
|
3e45385903 | ||
|
|
0796db97d4 | ||
|
|
644e290fcd | ||
|
|
d36d4c70d3 | ||
|
|
850c1095ab | ||
|
|
1d352645fc | ||
|
|
4805be1db6 | ||
|
|
0da5cb5fb6 | ||
|
|
55980684f6 | ||
|
|
e44deba1e9 | ||
|
|
c2d6ffb85f | ||
|
|
c4f1c20d80 | ||
|
|
49030f2a25 | ||
|
|
eba5e276c7 | ||
|
|
aec1a5eccc | ||
|
|
6122526cea | ||
|
|
9849c97b1b | ||
|
|
935d922114 | ||
|
|
8202b97077 | ||
|
|
a91f3d475e | ||
|
|
eb570294a2 | ||
|
|
ecba563f2f | ||
|
|
e922d89f66 | ||
|
|
87673d6e99 | ||
|
|
d6d08f97cd | ||
|
|
33766347cb | ||
|
|
493b2bff02 | ||
|
|
b044a7429e | ||
|
|
617f38b0e0 | ||
|
|
40f7fea897 | ||
|
|
1fd18821e0 | ||
|
|
ccb91cde94 | ||
|
|
99b242a6d0 | ||
|
|
2eacb53fc4 | ||
|
|
863d37ea66 | ||
|
|
6499581af7 | ||
|
|
ef75ddd4f9 | ||
|
|
9b3a1e00ab | ||
|
|
f74d7d92c8 | ||
|
|
6045de69c7 | ||
|
|
df683fa3b0 |
No files matched your search
@@ -1,3 +1,4 @@
|
||||
dist: precise
|
||||
language: c
|
||||
sudo: false
|
||||
addons:
|
||||
|
||||
@@ -1,17 +1,143 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2016, PHP 5.6.28
|
||||
04 Jan 2017, PHP 5.6.33
|
||||
|
||||
- GD:
|
||||
. Fixed bug #75571 (Potential infinite loop in gdImageCreateFromGifCtx). (cmb)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #74782 (Reflected XSS in .phar 404 page). (Stas)
|
||||
|
||||
26 Sep 2017, PHP 5.6.32
|
||||
|
||||
- Date:
|
||||
. Fixed bug #75055 (Out-Of-Bounds Read in timelib_meridian()). (Derick)
|
||||
|
||||
- mcrypt:
|
||||
. Fixed bug #72535 (arcfour encryption stream filter crashes php). (Leigh)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #75207 (applied upstream patch for CVE-2016-1283). (Anatol)
|
||||
|
||||
06 Jul 2017, PHP 5.6.31
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73807 (Performance problem with processing post request over
|
||||
2000000 chars). (Nikita)
|
||||
. Fixed bug #74111 (Heap buffer overread (READ: 1) finish_nested_data from
|
||||
unserialize). (Nikita)
|
||||
. Fixed bug #74603 (PHP INI Parsing Stack Buffer Overflow Vulnerability).
|
||||
(Stas)
|
||||
. Fixed bug #74819 (wddx_deserialize() heap out-of-bound read via
|
||||
php_parse_date()). (Derick)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #74435 (Buffer over-read into uninitialized memory). (cmb)
|
||||
|
||||
- mbstring:
|
||||
. Add oniguruma upstream fix (CVE-2017-9224, CVE-2017-9226, CVE-2017-9227,
|
||||
CVE-2017-9228, CVE-2017-9229) (Remi, Mamoru TASAKA)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #74651 (negative-size-param (-1) in memcpy in zif_openssl_seal()).
|
||||
(Stas)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #74087 (Segmentation fault in PHP7.1.1(compiled using the bundled PCRE library)).
|
||||
(Stas)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #74145 (wddx parsing empty boolean tag leads to SIGSEGV). (Stas)
|
||||
|
||||
19 Jan 2017, PHP 5.6.30
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #73737 (FPE when parsing a tag format). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #73549 (Use after free when stream is passed to imagepng). (cmb)
|
||||
. Fixed bug #73868 (DOS vulnerability in gdImageCreateFromGd2Ctx()). (cmb)
|
||||
. Fixed bug #73869 (Signed Integer Overflow gd_io.c). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #68447 (grapheme_extract take an extra trailing character).
|
||||
(SATŌ Kentarō)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #73764 (Crash while loading hostile phar archive). (Stas)
|
||||
. Fixed bug #73768 (Memory corruption when loading hostile phar). (Stas)
|
||||
. Fixed bug #73773 (Seg fault when loading hostile phar). (Stas)
|
||||
|
||||
- SQLite3:
|
||||
. Reverted fix for bug #73530 (Unsetting result set may reset other result
|
||||
set). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #70213 (Unserialize context shared on double class lookup).
|
||||
(Taoguang Chen)
|
||||
. Fixed bug #73825 (Heap out of bounds read on unserialize in
|
||||
finish_nested_data()). (Stas)
|
||||
|
||||
08 Dec 2016, PHP 5.6.29
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #73505 (string length overflow in mbfl_memory_device_output
|
||||
function). (Stas)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #64526 (Add missing mysqlnd.* parameters to php.ini-*). (cmb)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #73402 (Opcache segfault when using class constant to call a
|
||||
method). (Laruence)
|
||||
. Fixed bug #69090 (check cached files permissions)
|
||||
|
||||
- OpenSSL
|
||||
. Fixed bug #72776 (Invalid parameter in memcpy function trough
|
||||
openssl_pbkdf2). (Jakub Zelenka)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #73498 (Incorrect SQL generated for pg_copy_to()). (Craig Duncan)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #73452 (Segfault (Regression for #69152)). (Dmitry)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed bug #73530 (Unsetting result set may reset other result set). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73297 (HTTP stream wrapper should ignore HTTP 100 Continue).
|
||||
(rowan dot collins at gmail dot com)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #73631 (Memory leak due to invalid wddx stack processing).
|
||||
(bughunter at fosec dot vn).
|
||||
|
||||
10 Nov 2016, PHP 5.6.28
|
||||
|
||||
- Core:
|
||||
. Fixed bug #73337 (try/catch not working with two exceptions inside a same
|
||||
operation). (Dmitry)
|
||||
|
||||
- Bz2:
|
||||
. Fixed bug #73356 (crash in bzcompress function). (Stas)
|
||||
|
||||
-GD:
|
||||
. Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb)
|
||||
. Fixed bug #73272 (imagescale() is not affected by, but affects
|
||||
imagesetinterpolation()). (cmb)
|
||||
. Fixed bug #73279 (Integer overflow in gdImageScaleBilinearPalette()). (cmb)
|
||||
. Fixed bug #73280 (Stack Buffer Overflow in GD dynamicGetbuf). (cmb)
|
||||
. Fixed bug #72482 (Illegal write/read access caused by gdImageAALine overflow).
|
||||
(cmb)
|
||||
. Fixed bug #72696 (imagefilltoborder stackoverflow on truecolor images). (cmb)
|
||||
|
||||
- Imap:
|
||||
. Fixed bug #73418 (Integer Overflow in "_php_imap_mail" leads Heap Overflow).
|
||||
(Anatol)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #73144 (Use-after-free in ArrayObject Deserialization). (Stas)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #73037 (SoapServer reports Bad Request when gzipped). (Anatol)
|
||||
@@ -22,6 +148,11 @@ PHP NEWS
|
||||
- Standard:
|
||||
. Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb)
|
||||
. Fixed bug #73188 (use after free in userspace streams). (Sara)
|
||||
. Fixed bug #73192 (parse_url return wrong hostname). (Nikita)
|
||||
|
||||
- Wddx:
|
||||
. Fixed bug #73331 (NULL Pointer Dereference in WDDX Packet Deserialization
|
||||
with PDORow). (Stas)
|
||||
|
||||
13 Oct 2016, PHP 5.6.27
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
0=0&~2000000000
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #74603 (PHP INI Parsing Stack Buffer Overflow Vulnerability)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_INT_MAX !== 2147483647)
|
||||
die('skip for 32-bit only');
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(parse_ini_file(__DIR__ . "/bug74603.ini", true, INI_SCANNER_NORMAL));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "0"
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
Testing __debugInfo() magic method with bad returns RESOURCE
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
@@ -667,6 +667,7 @@ END_EXTERN_C()
|
||||
} \
|
||||
RETVAL_STRINGL((s), (int)__len, (dup)); \
|
||||
} while (0)
|
||||
#define RETURN_STRINGL_CHECK(s, len, dup) { RETVAL_STRINGL_CHECK(s, len, dup); return; }
|
||||
|
||||
|
||||
#define SET_VAR_STRING(n, v) { \
|
||||
|
||||
@@ -53,7 +53,7 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
|
||||
{
|
||||
int i_result;
|
||||
int i_op1, i_op2;
|
||||
char str_result[MAX_LENGTH_OF_LONG];
|
||||
char str_result[MAX_LENGTH_OF_LONG+1];
|
||||
|
||||
i_op1 = atoi(Z_STRVAL_P(op1));
|
||||
free(Z_STRVAL_P(op1));
|
||||
|
||||
@@ -1184,6 +1184,10 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c
|
||||
ALLOCA_FLAG(use_heap)
|
||||
|
||||
if (EXPECTED(key != NULL)) {
|
||||
#if (ZEND_GCC_VERSION == 4009) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
|
||||
/* This is a workaround for bug in GCC 4.9.2 */
|
||||
use_heap = 0;
|
||||
#endif
|
||||
lc_function_name = Z_STRVAL(key->constant);
|
||||
hash_value = key->hash_value;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -2263,7 +2263,7 @@ AC_DEFUN([PHP_SETUP_KERBEROS],[
|
||||
fi
|
||||
|
||||
dnl If krb5-config is found try using it
|
||||
if test "$PHP_KERBEROS" = "yes" && test -x "$KRB5_CONFIG"; then
|
||||
if test "$PHP_KERBEROS" != "no" && test -x "$KRB5_CONFIG"; then
|
||||
KERBEROS_LIBS=`$KRB5_CONFIG --libs gssapi`
|
||||
KERBEROS_CFLAGS=`$KRB5_CONFIG --cflags gssapi`
|
||||
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=28
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=33
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
+2
-2
@@ -513,7 +513,7 @@ static PHP_FUNCTION(bzcompress)
|
||||
dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600);
|
||||
|
||||
/* Allocate the destination buffer */
|
||||
dest = emalloc(dest_len + 1);
|
||||
dest = safe_emalloc(dest_len, 1, 1);
|
||||
|
||||
/* Handle the optional arguments */
|
||||
if (argc > 1) {
|
||||
@@ -533,7 +533,7 @@ static PHP_FUNCTION(bzcompress)
|
||||
so we erealloc() the buffer to the proper size */
|
||||
dest = erealloc(dest, dest_len + 1);
|
||||
dest[dest_len] = 0;
|
||||
RETURN_STRINGL(dest, dest_len, 0);
|
||||
RETURN_STRINGL_CHECK(dest, dest_len, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -35,7 +35,7 @@ static void curlfile_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
int fname_len, mime_len, postname_len;
|
||||
zval *cf = return_value;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ss", &fname, &fname_len, &mime, &mime_len, &postname, &postname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ss", &fname, &fname_len, &mime, &mime_len, &postname, &postname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+7261
-6578
File diff suppressed because it is too large.
Load diff
@@ -899,7 +899,7 @@ datefull = day ([ \t.-])* monthtext ([ \t.-])* year;
|
||||
datenoday = monthtext ([ .\t-])* year4;
|
||||
datenodayrev = year4 ([ .\t-])* monthtext;
|
||||
datetextual = monthtext ([ .\t-])* day [,.stndrh\t ]+ year;
|
||||
datenoyear = monthtext ([ .\t-])* day [,.stndrh\t ]*;
|
||||
datenoyear = monthtext ([ .\t-])* day ([,.stndrh\t ]+|[\000]);
|
||||
datenoyearrev = day ([ .\t-])* monthtext;
|
||||
datenocolon = year4 monthlz daylz;
|
||||
|
||||
@@ -917,8 +917,8 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
|
||||
firstdayof = 'first day of';
|
||||
lastdayof = 'last day of';
|
||||
backof = 'back of ' hour24 space? meridian?;
|
||||
frontof = 'front of ' hour24 space? meridian?;
|
||||
backof = 'back of ' hour24 (space? meridian)?;
|
||||
frontof = 'front of ' hour24 (space? meridian)?;
|
||||
|
||||
/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
|
||||
clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" secondlz space tzcorrection;
|
||||
|
||||
+1289
-993
File diff suppressed because it is too large.
Load diff
@@ -40,7 +40,7 @@ object(DateInterval)#%d (15) {
|
||||
["special_amount"]=>
|
||||
int(-1)
|
||||
["have_weekday_relative"]=>
|
||||
int(9)
|
||||
int(%d)
|
||||
["have_special_relative"]=>
|
||||
int(0)
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ foreach ( $tests as $start => $data )
|
||||
echo "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Sat, 23 Oct 2010 00:00:00 +0000
|
||||
Fri, 15 Oct 2010 23:00:00 +0000
|
||||
Wed, 15 Dec 2010 16:15:00 +0000
|
||||
Mon, 20 Dec 2010 00:00:00 +0000
|
||||
Mon, 20 Dec 2010 10:00:00 +0000
|
||||
Tue, 21 Dec 2010 12:00:00 +0000
|
||||
Mon, 03 Jan 2011 00:00:00 +0000
|
||||
Mon, 03 Jan 2011 09:00:00 +0000
|
||||
Sat, 23 Oct 2010 00:00:00 +0100
|
||||
Fri, 15 Oct 2010 23:00:00 +0100
|
||||
Sun, 28 Mar 2010 00:15:00 +0000
|
||||
Sun, 28 Mar 2010 02:15:00 +0100
|
||||
Sun, 28 Mar 2010 02:15:00 +0100
|
||||
+3
-3
@@ -1303,7 +1303,7 @@ static size_t exif_convert_any_to_int(void *value, int format, int motorola_inte
|
||||
if (s_den == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return php_ifd_get32s(value, motorola_intel) / s_den;
|
||||
return (size_t)((double)php_ifd_get32s(value, motorola_intel) / s_den);
|
||||
}
|
||||
|
||||
case TAG_FMT_SSHORT: return php_ifd_get16u(value, motorola_intel);
|
||||
@@ -2855,7 +2855,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
}
|
||||
|
||||
if (components < 0) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal components(%ld)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), components);
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal components(%d)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), components);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -4210,7 +4210,7 @@ PHP_FUNCTION(exif_imagetype)
|
||||
php_stream * stream;
|
||||
int itype = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &imagefile, &imagefile_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &imagefile, &imagefile_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #73737 (Crash when parsing a tag format)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
$exif = exif_thumbnail(__DIR__ . '/bug73737.tiff');
|
||||
var_dump($exif);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: exif_thumbnail(bug73737.tiff): Error in TIFF: filesize(x0030) less than start of IFD dir(x10102) in %s line %d
|
||||
bool(false)
|
||||
Binary file not shown.
@@ -142,23 +142,23 @@ Warning: exif_imagetype(0.5): failed to open stream: No such file or directory i
|
||||
bool(false)
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 15 --
|
||||
|
||||
@@ -198,7 +198,7 @@ Warning: exif_imagetype(obj'ct): failed to open stream: No such file or director
|
||||
bool(false)
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: exif_imagetype() expects parameter 1 to be string, resource given in %s on line %d
|
||||
Warning: exif_imagetype() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
-- Iteration 25 --
|
||||
|
||||
|
||||
+17
-1
@@ -61,6 +61,16 @@ static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l)
|
||||
}
|
||||
|
||||
static void _php_image_stream_ctxfree(struct gdIOCtx *ctx)
|
||||
{
|
||||
if(ctx->data) {
|
||||
ctx->data = NULL;
|
||||
}
|
||||
if(ctx) {
|
||||
efree(ctx);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -87,6 +97,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
gdIOCtx *ctx = NULL;
|
||||
zval *to_zval = NULL;
|
||||
php_stream *stream;
|
||||
int close_stream = 1;
|
||||
|
||||
/* The third (quality) parameter for Wbmp stands for the threshold when called from image2wbmp().
|
||||
* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called
|
||||
@@ -123,6 +134,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
if (stream == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
close_stream = 0;
|
||||
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
|
||||
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
|
||||
@@ -159,7 +171,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
ctx = emalloc(sizeof(gdIOCtx));
|
||||
ctx->putC = _php_image_stream_putc;
|
||||
ctx->putBuf = _php_image_stream_putbuf;
|
||||
ctx->gd_free = _php_image_stream_ctxfree;
|
||||
if (close_stream) {
|
||||
ctx->gd_free = _php_image_stream_ctxfreeandclose;
|
||||
} else {
|
||||
ctx->gd_free = _php_image_stream_ctxfree;
|
||||
}
|
||||
ctx->data = (void *)stream;
|
||||
}
|
||||
|
||||
|
||||
+4
-49
@@ -1117,7 +1117,7 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
}
|
||||
|
||||
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
|
||||
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) {
|
||||
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1301,55 +1301,10 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
|
||||
long x, y, inc, frac;
|
||||
long dx, dy,tmp;
|
||||
|
||||
if (y1 < 0 && y2 < 0) {
|
||||
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
|
||||
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) {
|
||||
return;
|
||||
}
|
||||
if (y1 < 0) {
|
||||
x1 += (y1 * (x1 - x2)) / (y2 - y1);
|
||||
y1 = 0;
|
||||
}
|
||||
if (y2 < 0) {
|
||||
x2 += (y2 * (x1 - x2)) / (y2 - y1);
|
||||
y2 = 0;
|
||||
}
|
||||
|
||||
/* bottom edge */
|
||||
if (y1 >= im->sy && y2 >= im->sy) {
|
||||
return;
|
||||
}
|
||||
if (y1 >= im->sy) {
|
||||
x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1);
|
||||
y1 = im->sy - 1;
|
||||
}
|
||||
if (y2 >= im->sy) {
|
||||
x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1);
|
||||
y2 = im->sy - 1;
|
||||
}
|
||||
|
||||
/* left edge */
|
||||
if (x1 < 0 && x2 < 0) {
|
||||
return;
|
||||
}
|
||||
if (x1 < 0) {
|
||||
y1 += (x1 * (y1 - y2)) / (x2 - x1);
|
||||
x1 = 0;
|
||||
}
|
||||
if (x2 < 0) {
|
||||
y2 += (x2 * (y1 - y2)) / (x2 - x1);
|
||||
x2 = 0;
|
||||
}
|
||||
/* right edge */
|
||||
if (x1 >= im->sx && x2 >= im->sx) {
|
||||
return;
|
||||
}
|
||||
if (x1 >= im->sx) {
|
||||
y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1);
|
||||
x1 = im->sx - 1;
|
||||
}
|
||||
if (x2 >= im->sx) {
|
||||
y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1);
|
||||
x2 = im->sx - 1;
|
||||
}
|
||||
|
||||
dx = x2 - x1;
|
||||
dy = y2 - y1;
|
||||
@@ -1792,7 +1747,7 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
int leftLimit = -1, rightLimit;
|
||||
int i, restoreAlphaBlending = 0;
|
||||
|
||||
if (border < 0) {
|
||||
if (border < 0 || color < 0) {
|
||||
/* Refuse to fill to a non-solid border */
|
||||
return;
|
||||
}
|
||||
|
||||
+10
-2
@@ -136,6 +136,10 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
GD2_DBG(php_gd_error("%d Chunks vertically", *ncy));
|
||||
|
||||
if (gd2_compressed(*fmt)) {
|
||||
if (*ncx <= 0 || *ncy <= 0 || *ncx > INT_MAX / *ncy) {
|
||||
GD2_DBG(printf ("Illegal chunk counts: %d * %d\n", *ncx, *ncy));
|
||||
goto fail1;
|
||||
}
|
||||
nc = (*ncx) * (*ncy);
|
||||
GD2_DBG(php_gd_error("Reading %d chunk index entries", nc));
|
||||
if (overflow2(sizeof(t_chunk_info), nc)) {
|
||||
@@ -340,12 +344,16 @@ gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
|
||||
for (x = xlo; x < xhi; x++) {
|
||||
if (im->trueColor) {
|
||||
if (!gdGetInt(&im->tpixels[y][x], in)) {
|
||||
im->tpixels[y][x] = 0;
|
||||
php_gd_error("gd2: EOF while reading\n");
|
||||
gdImageDestroy(im);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
int ch;
|
||||
if (!gdGetByte(&ch, in)) {
|
||||
ch = 0;
|
||||
php_gd_error("gd2: EOF while reading\n");
|
||||
gdImageDestroy(im);
|
||||
return NULL;
|
||||
}
|
||||
im->pixels[y][x] = ch;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,9 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
|
||||
int haveGlobalColormap;
|
||||
gdImagePtr im = 0;
|
||||
|
||||
memset(ColorMap, 0, 3 * MAXCOLORMAPSIZE);
|
||||
memset(localColorMap, 0, 3 * MAXCOLORMAPSIZE);
|
||||
|
||||
/*1.4//imageNumber = 1; */
|
||||
if (! ReadOK(fd,buf,6)) {
|
||||
return 0;
|
||||
@@ -258,10 +261,6 @@ terminated:
|
||||
if (!im) {
|
||||
return 0;
|
||||
}
|
||||
if (!im->colorsTotal) {
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
}
|
||||
/* Check for open colors at the end, so
|
||||
we can reduce colorsTotal and ultimately
|
||||
BitsPerPixel */
|
||||
@@ -272,6 +271,10 @@ terminated:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!im->colorsTotal) {
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
}
|
||||
return im;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -372,7 +375,7 @@ static int
|
||||
GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroDataBlockP)
|
||||
{
|
||||
int i, j, ret;
|
||||
unsigned char count;
|
||||
int count;
|
||||
|
||||
if (flag) {
|
||||
scd->curbit = 0;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #72482 (Ilegal write/read access caused by gdImageAALine overflow)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$img = imagecreatetruecolor(13, 1007);
|
||||
imageantialias($img, true);
|
||||
imageline($img, 0, 0, 1073745919, 1073745919, 4096);
|
||||
|
||||
$img = imagecreatetruecolor(100, 100);
|
||||
imageantialias($img, true);
|
||||
imageline($img, 1094795585, 0, 2147483647, 255, 0xff);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug 72482 (Ilegal write/read access caused by gdImageAALine overflow)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
imagefilledrectangle($im, 0, 0, 9, 9, imagecolorallocate($im, 255, 255, 255));
|
||||
imageantialias($im, true);
|
||||
imageline($im, 0, 0, 10, 10, imagecolorallocate($im, 0, 0, 0));
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug72482_2.png', $im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 118 B |
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #72696 (imagefilltoborder stackoverflow on truecolor images)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(10, 10);
|
||||
imagefilltoborder($im, 0, 0, 1, -2);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #73549 (Use after free when stream is passed to imagepng)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$stream = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png', 'w');
|
||||
$im = imagecreatetruecolor(8, 8);
|
||||
var_dump(imagepng($im, $stream));
|
||||
var_dump($stream);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
resource(%d) of type (stream)
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png');
|
||||
?>
|
||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 73868 (DOS vulnerability in gdImageCreateFromGd2Ctx())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73868.gd2'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromgd2(): gd2: EOF while reading
|
||||
in %s on line %d
|
||||
|
||||
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #73869 (Signed Integer Overflow gd_io.c)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869a.gd2'));
|
||||
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869b.gd2'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #74435 (Buffer over-read into uninitialized memory)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatefromgif(__DIR__ . DIRECTORY_SEPARATOR . 'bug74435.gif');
|
||||
var_dump($im);
|
||||
$width = imagesx($im);
|
||||
$height = imagesy($im);
|
||||
for ($i = 0; $i < $width; $i += 16) {
|
||||
for ($j = 0; $j < $height; $j += 16) {
|
||||
if (($index = imagecolorat($im, $i, $j)) >= 2) {
|
||||
list($red, $green, $blue, $alpha) = array_values(imagecolorsforindex($im, $index));
|
||||
if ($red !== 0 || $green !== 0 || $blue !== 0 || $alpha !== 0) {
|
||||
echo "unexpected color at ($i, $j)\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
resource(%d) of type (gd)
|
||||
===DONE===
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #75571 (Infinite loop in GIF reading causing DoS)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(imagecreatefromgif(__DIR__ . '/bug75571.gif'));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromgif(): '%s' is not a valid GIF file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -4,6 +4,7 @@ Font charmap order is deterministic based on order in the font, use the selected
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imagettftext')) die('skip imagettftext() not available');
|
||||
if(gd_info()['JIS-mapped Japanese Font Support']) die('skip JIS-mapped Japanese Font Support not supported');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
+1
-1
@@ -2491,7 +2491,7 @@ PHP_NAMED_FUNCTION(php_if_iconv)
|
||||
&out_buffer, &out_len, out_charset, in_charset);
|
||||
_php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC);
|
||||
if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) {
|
||||
RETVAL_STRINGL(out_buffer, out_len, 0);
|
||||
RETVAL_STRINGL_CHECK(out_buffer, out_len, 0);
|
||||
} else {
|
||||
if (out_buffer != NULL) {
|
||||
efree(out_buffer);
|
||||
|
||||
+2
-2
@@ -3900,7 +3900,7 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
char *tsm_errmsg = NULL;
|
||||
ADDRESS *addr;
|
||||
char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL, *bufferHeader = NULL;
|
||||
int offset, bufferLen = 0;
|
||||
size_t offset, bufferLen = 0;
|
||||
size_t bt_len;
|
||||
|
||||
if (headers) {
|
||||
@@ -3916,7 +3916,7 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
|
||||
#define PHP_IMAP_CLEAN if (bufferTo) efree(bufferTo); if (bufferCc) efree(bufferCc); if (bufferBcc) efree(bufferBcc); if (bufferHeader) efree(bufferHeader);
|
||||
#define PHP_IMAP_BAD_DEST PHP_IMAP_CLEAN; efree(tempMailTo); return (BAD_MSG_DESTINATION);
|
||||
|
||||
bufferHeader = (char *)emalloc(bufferLen + 1);
|
||||
bufferHeader = (char *)safe_emalloc(bufferLen, 1, 1);
|
||||
memset(bufferHeader, 0, bufferLen);
|
||||
if (to && *to) {
|
||||
strlcat(bufferHeader, "To: ", bufferLen + 1);
|
||||
|
||||
@@ -182,7 +182,7 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_
|
||||
}
|
||||
assert(next <= slen && next >= cur);
|
||||
len = next - cur;
|
||||
res = static_cast<char*>(emalloc(len + 1));
|
||||
res = static_cast<char*>(safe_emalloc(len, 1, 1));
|
||||
|
||||
memcpy(res, &s[cur], len);
|
||||
res[len] = '\0';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#ifndef COLLATOR_COLLATOR_H
|
||||
#define CCOLLATOR_COLLATOR_H
|
||||
#define COLLATOR_COLLATOR_H
|
||||
|
||||
#include <php.h>
|
||||
|
||||
|
||||
@@ -702,8 +702,10 @@ PHP_FUNCTION(grapheme_stristr)
|
||||
static inline int32_t
|
||||
grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char *pstr, int32_t str_len)
|
||||
{
|
||||
int pos = 0, prev_pos = 0;
|
||||
int ret_pos = 0, prev_ret_pos = 0;
|
||||
int pos = 0;
|
||||
int ret_pos = 0;
|
||||
int break_pos, prev_break_pos;
|
||||
int count = 0;
|
||||
|
||||
while ( 1 ) {
|
||||
pos = ubrk_next(bi);
|
||||
@@ -712,23 +714,24 @@ grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char
|
||||
break;
|
||||
}
|
||||
|
||||
for ( break_pos = ret_pos; break_pos < pos; ) {
|
||||
count++;
|
||||
prev_break_pos = break_pos;
|
||||
U8_FWD_1(pstr, break_pos, str_len);
|
||||
|
||||
if ( prev_break_pos == break_pos ) {
|
||||
/* something wrong - malformed utf8? */
|
||||
csize = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we are beyond our limit, then the loop is done */
|
||||
if ( pos > csize ) {
|
||||
if ( count > csize ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* update our pointer in the original UTF-8 buffer by as many characters
|
||||
as ubrk_next iterated over */
|
||||
|
||||
prev_ret_pos = ret_pos;
|
||||
U8_FWD_N(pstr, ret_pos, str_len, pos - prev_pos);
|
||||
|
||||
if ( prev_ret_pos == ret_pos ) {
|
||||
/* something wrong - malformed utf8? */
|
||||
break;
|
||||
}
|
||||
|
||||
prev_pos = pos;
|
||||
ret_pos = break_pos;
|
||||
}
|
||||
|
||||
return ret_pos;
|
||||
@@ -739,8 +742,8 @@ grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned char
|
||||
static inline int32_t
|
||||
grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char *pstr, int32_t str_len)
|
||||
{
|
||||
int pos = 0, prev_pos = 0;
|
||||
int ret_pos = 0, prev_ret_pos = 0;
|
||||
int pos = 0;
|
||||
int ret_pos = 0;
|
||||
|
||||
while ( 1 ) {
|
||||
pos = ubrk_next(bi);
|
||||
@@ -749,20 +752,11 @@ grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char
|
||||
break;
|
||||
}
|
||||
|
||||
prev_ret_pos = ret_pos;
|
||||
U8_FWD_N(pstr, ret_pos, str_len, pos - prev_pos);
|
||||
|
||||
if ( ret_pos > bsize ) {
|
||||
ret_pos = prev_ret_pos;
|
||||
if ( pos > bsize ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( prev_ret_pos == ret_pos ) {
|
||||
/* something wrong - malformed utf8? */
|
||||
break;
|
||||
}
|
||||
|
||||
prev_pos = pos;
|
||||
ret_pos = pos;
|
||||
}
|
||||
|
||||
return ret_pos;
|
||||
@@ -773,7 +767,7 @@ grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned char
|
||||
static inline int32_t
|
||||
grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char *pstr, int32_t str_len)
|
||||
{
|
||||
int pos = 0, next_pos = 0;
|
||||
int next_pos = 0;
|
||||
int ret_pos = 0;
|
||||
|
||||
while ( size ) {
|
||||
@@ -782,16 +776,10 @@ grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char *pst
|
||||
if ( UBRK_DONE == next_pos ) {
|
||||
break;
|
||||
}
|
||||
pos = next_pos;
|
||||
ret_pos = next_pos;
|
||||
size--;
|
||||
}
|
||||
|
||||
/* pos is one past the last UChar - and represent the number of code units to
|
||||
advance in the utf-8 buffer
|
||||
*/
|
||||
|
||||
U8_FWD_N(pstr, ret_pos, str_len, pos);
|
||||
|
||||
return ret_pos;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -810,9 +798,9 @@ static grapheme_extract_iter grapheme_extract_iters[] = {
|
||||
Function to extract a sequence of default grapheme clusters */
|
||||
PHP_FUNCTION(grapheme_extract)
|
||||
{
|
||||
unsigned char *str, *pstr;
|
||||
UChar *ustr;
|
||||
int str_len, ustr_len;
|
||||
char *str, *pstr;
|
||||
UText ut = UTEXT_INITIALIZER;
|
||||
int str_len;
|
||||
long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */
|
||||
long lstart = 0; /* starting position in str in bytes */
|
||||
int32_t start = 0;
|
||||
@@ -900,21 +888,15 @@ PHP_FUNCTION(grapheme_extract)
|
||||
RETURN_STRINGL(((char *)pstr), nsize, 1);
|
||||
}
|
||||
|
||||
/* convert the strings to UTF-16. */
|
||||
ustr = NULL;
|
||||
ustr_len = 0;
|
||||
status = U_ZERO_ERROR;
|
||||
intl_convert_utf8_to_utf16(&ustr, &ustr_len, (char *)pstr, str_len, &status );
|
||||
utext_openUTF8(&ut, pstr, str_len, &status);
|
||||
|
||||
if ( U_FAILURE( status ) ) {
|
||||
/* Set global error code. */
|
||||
intl_error_set_code( NULL, status TSRMLS_CC );
|
||||
|
||||
/* Set error messages. */
|
||||
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
|
||||
|
||||
if ( NULL != ustr )
|
||||
efree( ustr );
|
||||
intl_error_set_custom_msg( NULL, "Error opening UTF-8 text", 0 TSRMLS_CC );
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -923,8 +905,7 @@ PHP_FUNCTION(grapheme_extract)
|
||||
status = U_ZERO_ERROR;
|
||||
bi = grapheme_get_break_iterator(u_break_iterator_buffer, &status TSRMLS_CC );
|
||||
|
||||
ubrk_setText(bi, ustr, ustr_len, &status);
|
||||
|
||||
ubrk_setUText(bi, &ut, &status);
|
||||
/* if the caller put us in the middle of a grapheme, we can't detect it in all cases since we
|
||||
can't back up. So, we will not do anything. */
|
||||
|
||||
@@ -932,9 +913,7 @@ PHP_FUNCTION(grapheme_extract)
|
||||
|
||||
ret_pos = (*grapheme_extract_iters[extract_type])(bi, size, pstr, str_len);
|
||||
|
||||
if (ustr) {
|
||||
efree(ustr);
|
||||
}
|
||||
utext_close(&ut);
|
||||
ubrk_close(bi);
|
||||
|
||||
if ( NULL != next ) {
|
||||
|
||||
@@ -49,7 +49,7 @@ void intl_convert_utf8_to_utf16(
|
||||
UErrorCode* status )
|
||||
{
|
||||
UChar* dst_buf = NULL;
|
||||
int32_t dst_len = 0;
|
||||
uint32_t dst_len = 0;
|
||||
|
||||
/* If *target is NULL determine required destination buffer size (pre-flighting).
|
||||
* Otherwise, attempt to convert source string; if *target buffer is not large enough
|
||||
|
||||
@@ -263,6 +263,9 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
|
||||
int32_t buflen = 512;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
if (strlen(loc_name) > INTL_MAX_LOCALE_LEN) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( strcmp(tag_name, LOC_CANONICALIZE_TAG) != 0 ){
|
||||
/* Handle grandfathered languages */
|
||||
@@ -395,7 +398,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
|
||||
|
||||
/* Call ICU get */
|
||||
@@ -702,6 +705,8 @@ PHP_FUNCTION( locale_get_keywords )
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
@@ -1109,6 +1114,8 @@ PHP_FUNCTION(locale_parse)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = intl_locale_get_default(TSRMLS_C);
|
||||
}
|
||||
|
||||
@@ -80,10 +80,10 @@ msgformat_data* msgformat_data_create( TSRMLS_D )
|
||||
/* }}} */
|
||||
|
||||
#ifdef MSG_FORMAT_QUOTE_APOS
|
||||
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec)
|
||||
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec)
|
||||
{
|
||||
if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) {
|
||||
UChar *npattern = emalloc(sizeof(UChar)*(2*(*spattern_len)+1));
|
||||
UChar *npattern = safe_emalloc(sizeof(UChar)*2, *spattern_len, sizeof(UChar));
|
||||
uint32_t npattern_len;
|
||||
npattern_len = umsg_autoQuoteApostrophe(*spattern, *spattern_len, npattern, 2*(*spattern_len)+1, ec);
|
||||
efree(*spattern);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #68447: grapheme_extract take an extra trailing character
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$katsushikaku = "葛󠄁飾区";
|
||||
echo grapheme_extract($katsushikaku, 1) . "\n";
|
||||
|
||||
$haiyore = "這󠄀いよれ";
|
||||
echo grapheme_extract($haiyore, 1, GRAPHEME_EXTR_COUNT) . "\n";
|
||||
echo grapheme_extract($haiyore, 2, GRAPHEME_EXTR_COUNT) . "\n";
|
||||
echo grapheme_extract($haiyore, 6, GRAPHEME_EXTR_MAXBYTES) . "\n";
|
||||
echo grapheme_extract($haiyore, 9, GRAPHEME_EXTR_MAXBYTES) . "\n";
|
||||
echo grapheme_extract($haiyore, 12, GRAPHEME_EXTR_MAXBYTES) . "\n";
|
||||
echo grapheme_extract($haiyore, 1, GRAPHEME_EXTR_MAXCHARS) . "\n";
|
||||
echo grapheme_extract($haiyore, 2, GRAPHEME_EXTR_MAXCHARS) . "\n";
|
||||
echo grapheme_extract($haiyore, 3, GRAPHEME_EXTR_MAXCHARS) . "\n";
|
||||
--EXPECT--
|
||||
葛󠄁
|
||||
這󠄀
|
||||
這󠄀い
|
||||
|
||||
這󠄀
|
||||
這󠄀い
|
||||
|
||||
這󠄀
|
||||
這󠄀い
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE NOTICES
|
||||
*
|
||||
* This file is part of "streamable kanji code filter and converter",
|
||||
* which is distributed under the terms of GNU Lesser General Public
|
||||
* which is distributed under the terms of GNU Lesser General Public
|
||||
* License (version 2) as published by the Free Software Foundation.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
@@ -146,6 +146,10 @@ mbfl_memory_device_output(int c, void *data)
|
||||
unsigned char *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
@@ -169,6 +173,10 @@ mbfl_memory_device_output2(int c, void *data)
|
||||
unsigned char *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
@@ -194,6 +202,10 @@ mbfl_memory_device_output4(int c, void* data)
|
||||
unsigned char *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
@@ -227,7 +239,12 @@ mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc)
|
||||
if ((device->pos + len) >= device->length) {
|
||||
/* reallocate buffer */
|
||||
int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char);
|
||||
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
unsigned char *tmp;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -254,7 +271,12 @@ mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len
|
||||
if ((device->pos + len) >= device->length) {
|
||||
/* reallocate buffer */
|
||||
int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
|
||||
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
unsigned char *tmp;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -281,7 +303,12 @@ mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src)
|
||||
if ((dest->pos + src->pos) >= dest->length) {
|
||||
/* reallocate buffer */
|
||||
int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
|
||||
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
|
||||
unsigned char *tmp;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@@ -336,6 +363,10 @@ mbfl_wchar_device_output(int c, void *data)
|
||||
unsigned int *tmp;
|
||||
|
||||
newlen = device->length + device->allocsz;
|
||||
if (newlen <= 0) {
|
||||
/* overflow */
|
||||
return -1;
|
||||
}
|
||||
tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int));
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
|
||||
@@ -1425,14 +1425,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
|
||||
break;
|
||||
|
||||
case OP_EXACT1: MOP_IN(OP_EXACT1);
|
||||
#if 0
|
||||
DATA_ENSURE(1);
|
||||
if (*p != *s) goto fail;
|
||||
p++; s++;
|
||||
#endif
|
||||
if (*p != *s++) goto fail;
|
||||
DATA_ENSURE(0);
|
||||
p++;
|
||||
MOP_OUT;
|
||||
break;
|
||||
|
||||
@@ -3128,6 +3123,8 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
|
||||
}
|
||||
else {
|
||||
UChar *q = p + reg->dmin;
|
||||
|
||||
if (q >= end) return 0; /* fail */
|
||||
while (p < q) p += enclen(reg->enc, p);
|
||||
}
|
||||
}
|
||||
@@ -3208,7 +3205,13 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
|
||||
else {
|
||||
if (reg->dmax != ONIG_INFINITE_DISTANCE) {
|
||||
*low = p - reg->dmax;
|
||||
if (*low > s) {
|
||||
if (p - str < reg->dmax) {
|
||||
*low = (UChar* )str;
|
||||
if (low_prev)
|
||||
*low_prev = onigenc_get_prev_char_head(reg->enc, str, *low);
|
||||
}
|
||||
else {
|
||||
if (*low > s) {
|
||||
*low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s,
|
||||
*low, (const UChar** )low_prev);
|
||||
if (low_prev && IS_NULL(*low_prev))
|
||||
@@ -3221,6 +3224,7 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
|
||||
(pprev ? pprev : str), *low);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* no needs to adjust *high, *high is used as range check only */
|
||||
*high = p - reg->dmin;
|
||||
|
||||
@@ -3064,7 +3064,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
|
||||
PUNFETCH;
|
||||
prev = p;
|
||||
num = scan_unsigned_octal_number(&p, end, 3, enc);
|
||||
if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
|
||||
if (num < 0 || num >= 256) return ONIGERR_TOO_BIG_NUMBER;
|
||||
if (p == prev) { /* can't read nothing. */
|
||||
num = 0; /* but, it's not error */
|
||||
}
|
||||
@@ -3436,7 +3436,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
|
||||
if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_OCTAL3)) {
|
||||
prev = p;
|
||||
num = scan_unsigned_octal_number(&p, end, (c == '0' ? 2:3), enc);
|
||||
if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
|
||||
if (num < 0 || num >= 256) return ONIGERR_TOO_BIG_NUMBER;
|
||||
if (p == prev) { /* can't read nothing. */
|
||||
num = 0; /* but, it's not error */
|
||||
}
|
||||
@@ -4068,7 +4068,9 @@ next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,
|
||||
}
|
||||
}
|
||||
|
||||
*state = CCS_VALUE;
|
||||
if (*state != CCS_START)
|
||||
*state = CCS_VALUE;
|
||||
|
||||
*type = CCV_CLASS;
|
||||
return 0;
|
||||
}
|
||||
@@ -4084,7 +4086,11 @@ next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,
|
||||
switch (*state) {
|
||||
case CCS_VALUE:
|
||||
if (*type == CCV_SB)
|
||||
{
|
||||
if (*vs > 0xff)
|
||||
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
||||
BITSET_SET_BIT(cc->bs, (int )(*vs));
|
||||
}
|
||||
else if (*type == CCV_CODE_POINT) {
|
||||
r = add_code_range(&(cc->mbuf), env, *vs, *vs);
|
||||
if (r < 0) return r;
|
||||
|
||||
@@ -89,7 +89,7 @@ static php_stream_filter_status_t php_mcrypt_filter(
|
||||
php_stream_bucket_delref(bucket TSRMLS_CC);
|
||||
} else {
|
||||
/* Stream cipher */
|
||||
php_stream_bucket_make_writeable(bucket TSRMLS_CC);
|
||||
bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC);
|
||||
if (data->encrypt) {
|
||||
mcrypt_generic(data->module, bucket->buf, bucket->buflen);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #72535 arcfour encryption stream filter crashes php
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$passphrase = 'My secret';
|
||||
$plaintext = 'Secret secret secret data';
|
||||
|
||||
$iv = substr(md5('iv' . $passphrase, true), 0, 8);
|
||||
$key = substr(md5('pass1' . $passphrase, true) .
|
||||
md5('pass2' . $passphrase, true), 0, 24);
|
||||
$opts = array('iv' => $iv, 'key' => $key, 'mode' => 'stream');
|
||||
|
||||
$expected = substr($plaintext . $plaintext, 0, 48);
|
||||
|
||||
$fp = fopen('php://memory', 'wb+');
|
||||
stream_filter_append($fp, 'mcrypt.arcfour', STREAM_FILTER_WRITE, $opts);
|
||||
fwrite($fp, $plaintext);
|
||||
?>
|
||||
==NOCRASH==
|
||||
--EXPECT--
|
||||
==NOCRASH==
|
||||
@@ -157,7 +157,7 @@ static void update_op1_const(zend_op_array *op_array,
|
||||
opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
Z_HASH_P(&ZEND_OP1_LITERAL(opline)) = zend_hash_func(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1);
|
||||
op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
Z_STRVAL_P(val) = zend_str_tolower_dup(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op1.constant+1].constant), Z_STRLEN(op_array->literals[opline->op1.constant+1].constant) + 1);
|
||||
break;
|
||||
@@ -205,13 +205,13 @@ static void update_op2_const(zend_op_array *op_array,
|
||||
case ZEND_ADD_INTERFACE:
|
||||
case ZEND_ADD_TRAIT:
|
||||
op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++;
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
Z_STRVAL_P(val) = zend_str_tolower_dup(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
break;
|
||||
case ZEND_INIT_METHOD_CALL:
|
||||
case ZEND_INIT_STATIC_METHOD_CALL:
|
||||
zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
Z_STRVAL_P(val) = zend_str_tolower_dup(Z_STRVAL_P(val), Z_STRLEN_P(val));
|
||||
zend_optimizer_add_literal(op_array, val TSRMLS_CC);
|
||||
op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals[opline->op2.constant+1].constant), Z_STRLEN(op_array->literals[opline->op2.constant+1].constant) + 1);
|
||||
/* break missing intentionally */
|
||||
|
||||
@@ -102,6 +102,16 @@ opcache.validate_timestamps (default "1")
|
||||
The frequency of the check is controlled by the directive
|
||||
"opcache.revalidate_freq".
|
||||
|
||||
opcache.validate_permission (default "0")
|
||||
Leads OPcache to check file readability on each access to cached file.
|
||||
This directive should be enabled in shared hosting environment, when few
|
||||
users (PHP-FPM pools) reuse the common OPcache shared memory.
|
||||
|
||||
opcache.validate_root (default "0")
|
||||
This directive prevents file name collisions in different "chroot"
|
||||
environments. It should be enabled for sites that may serve requests in
|
||||
different "chroot" environments.
|
||||
|
||||
opcache.revalidate_freq (default "2")
|
||||
How often (in seconds) to check file timestamps for changes to the shared
|
||||
memory storage allocation. ("1" means validate once per second, but only
|
||||
|
||||
@@ -1592,6 +1592,28 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
|
||||
persistent_script = NULL;
|
||||
}
|
||||
|
||||
/* Revalidate acessibility of cached file */
|
||||
if (EXPECTED(persistent_script != NULL) &&
|
||||
UNEXPECTED(ZCG(accel_directives).validate_permission) &&
|
||||
file_handle->type == ZEND_HANDLE_FILENAME &&
|
||||
UNEXPECTED(access(persistent_script->full_path, R_OK) != 0)) {
|
||||
if (type == ZEND_REQUIRE) {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
zend_bailout();
|
||||
} else {
|
||||
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
|
||||
#else
|
||||
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SHM_UNPROTECT();
|
||||
|
||||
/* If script is found then validate_timestamps if option is enabled */
|
||||
@@ -2126,6 +2148,27 @@ static void accel_activate(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef ZEND_WIN32
|
||||
if (ZCG(accel_directives).validate_root) {
|
||||
struct stat buf;
|
||||
|
||||
if (stat("/", &buf) != 0) {
|
||||
ZCG(root_hash) = 0;
|
||||
} else {
|
||||
ZCG(root_hash) = buf.st_ino;
|
||||
if (sizeof(buf.st_ino) > sizeof(ZCG(root_hash))) {
|
||||
if (ZCG(root_hash) != buf.st_ino) {
|
||||
zend_alter_ini_entry("opcache.enable", sizeof("opcache.enable"), "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME);
|
||||
zend_accel_error(ACCEL_LOG_WARNING, "Can't cache files in chroot() directory with too big inode");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ZCG(root_hash) = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
SHM_UNPROTECT();
|
||||
/* PHP-5.4 and above return "double", but we use 1 sec precision */
|
||||
ZCG(request_time) = (time_t)sapi_get_request_time(TSRMLS_C);
|
||||
|
||||
@@ -230,6 +230,10 @@ typedef struct _zend_accel_directives {
|
||||
zend_bool file_override_enabled;
|
||||
zend_bool inherited_hack;
|
||||
zend_bool enable_cli;
|
||||
zend_bool validate_permission;
|
||||
#ifndef ZEND_WIN32
|
||||
zend_bool validate_root;
|
||||
#endif
|
||||
unsigned long revalidate_freq;
|
||||
unsigned long file_update_protection;
|
||||
char *error_log;
|
||||
@@ -264,6 +268,9 @@ typedef struct _zend_accel_globals {
|
||||
int include_path_len; /* "include_path" string length */
|
||||
int include_path_check;
|
||||
time_t request_time;
|
||||
#ifndef ZEND_WIN32
|
||||
unsigned long root_hash;
|
||||
#endif
|
||||
/* preallocated shared-memory block to save current script */
|
||||
void *mem;
|
||||
/* cache to save hash lookup on the same INCLUDE opcode */
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #73402 (Opcache segfault when using class constant to call a method)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
class Logger {
|
||||
public function info($msg) {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
const LOG_LEVEL = 'Info';
|
||||
public function test()
|
||||
{
|
||||
$logger = new \Logger();
|
||||
$logger->{self::LOG_LEVEL}('test');
|
||||
}
|
||||
}
|
||||
|
||||
$b = new B;
|
||||
$b->test();
|
||||
--EXPECT--
|
||||
test
|
||||
@@ -77,6 +77,9 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry;
|
||||
zend_accel_hash_entry *indirect_bucket = NULL;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
if (indirect) {
|
||||
indirect_bucket = (zend_accel_hash_entry*)data;
|
||||
@@ -86,6 +89,9 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char
|
||||
}
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
/* try to see if the element already exists in the hash */
|
||||
@@ -145,8 +151,14 @@ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key
|
||||
zend_ulong hash_value;
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
entry = accel_hash->hash_table[index];
|
||||
@@ -173,8 +185,14 @@ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, c
|
||||
zend_ulong hash_value;
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
entry = accel_hash->hash_table[index];
|
||||
@@ -198,8 +216,14 @@ int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, zend_uint key
|
||||
zend_ulong hash_value;
|
||||
zend_ulong index;
|
||||
zend_accel_hash_entry *entry, *last_entry=NULL;
|
||||
#ifndef ZEND_WIN32
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
hash_value = zend_inline_hash_func(key, key_length);
|
||||
#ifndef ZEND_WIN32
|
||||
hash_value ^= ZCG(root_hash);
|
||||
#endif
|
||||
index = hash_value % accel_hash->max_num_entries;
|
||||
|
||||
entry = accel_hash->hash_table[index];
|
||||
|
||||
@@ -255,6 +255,10 @@ ZEND_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("opcache.enable" , "1", PHP_INI_ALL, OnEnable, enabled , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.use_cwd" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.use_cwd , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.validate_timestamps", "1", PHP_INI_ALL , OnUpdateBool, accel_directives.validate_timestamps, zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.validate_permission", "0", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.validate_permission, zend_accel_globals, accel_globals)
|
||||
#ifndef ZEND_WIN32
|
||||
STD_PHP_INI_BOOLEAN("opcache.validate_root" , "0", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.validate_root , zend_accel_globals, accel_globals)
|
||||
#endif
|
||||
STD_PHP_INI_BOOLEAN("opcache.inherited_hack" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.inherited_hack , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.dups_fix" , "0", PHP_INI_ALL , OnUpdateBool, accel_directives.ignore_dups , zend_accel_globals, accel_globals)
|
||||
STD_PHP_INI_BOOLEAN("opcache.revalidate_path" , "0", PHP_INI_ALL , OnUpdateBool, accel_directives.revalidate_path , zend_accel_globals, accel_globals)
|
||||
@@ -663,6 +667,10 @@ static ZEND_FUNCTION(opcache_get_configuration)
|
||||
add_assoc_bool(directives, "opcache.enable_cli", ZCG(accel_directives).enable_cli);
|
||||
add_assoc_bool(directives, "opcache.use_cwd", ZCG(accel_directives).use_cwd);
|
||||
add_assoc_bool(directives, "opcache.validate_timestamps", ZCG(accel_directives).validate_timestamps);
|
||||
add_assoc_bool(directives, "opcache.validate_permission", ZCG(accel_directives).validate_permission);
|
||||
#ifndef ZEND_WIN32
|
||||
add_assoc_bool(directives, "opcache.validate_root", ZCG(accel_directives).validate_root);
|
||||
#endif
|
||||
add_assoc_bool(directives, "opcache.inherited_hack", ZCG(accel_directives).inherited_hack);
|
||||
add_assoc_bool(directives, "opcache.dups_fix", ZCG(accel_directives).ignore_dups);
|
||||
add_assoc_bool(directives, "opcache.revalidate_path", ZCG(accel_directives).revalidate_path);
|
||||
|
||||
@@ -4059,7 +4059,7 @@ PHP_FUNCTION(openssl_pbkdf2)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_length <= 0) {
|
||||
if (key_length <= 0 || key_length > INT_MAX) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -4982,15 +4982,15 @@ PHP_FUNCTION(openssl_seal)
|
||||
buf = emalloc(data_len + EVP_CIPHER_CTX_block_size(&ctx));
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
|
||||
if (!EVP_SealInit(&ctx, cipher, eks, eksl, NULL, pkeys, nkeys) || !EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) {
|
||||
if (EVP_SealInit(&ctx, cipher, eks, eksl, NULL, pkeys, nkeys) <= 0 ||
|
||||
!EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len) ||
|
||||
!EVP_SealFinal(&ctx, buf + len1, &len2)) {
|
||||
RETVAL_FALSE;
|
||||
efree(buf);
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
EVP_SealFinal(&ctx, buf + len1, &len2);
|
||||
|
||||
if (len1 + len2 > 0) {
|
||||
zval_dtor(sealdata);
|
||||
buf[len1 + len2] = '\0';
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEoDCCBAmgAwIBAgIBJzANBgkqhkiG9w0BAQQFADCBkDELMAkGA1UEFhMCUk8x
|
||||
EDAOBgNVBAgTB1JvbWFuaWExEDAOBgNVBAcTB0NyYWlvdmExDzANBgNVBAoTBlNl
|
||||
cmdpdTETMBEGA1UECxMKU2VyZ2l1IFNSTDESMBAGA1UEAxMJU2VyZ2l1IENBMSMw
|
||||
IQYJKoZIhvcNAQkBFhRuX3NlcmdpdUBob3RtYWlsLmNvbTAeFw0wNDA1MTQxMzM0
|
||||
NTZaFw0wNTA1MTQxMzM0NTZaMIGaMQswCQYDVQQGEwJSTzEQMA4GA1UECBMHUm9t
|
||||
YW5pYTEQMA4GA1UEBxMHQ3JhaW92YTETMBEGA1UEChMKU2VyZ2l1IFNSTDETMBEG
|
||||
A1UECxMKU2VyZ2l1IFNSTDEYMBYGA1UEAxMPU2VyZ2l1IHBlcnNvbmFsMSMwIQYJ
|
||||
KoZIhvcNAQkBFhRuX3NlcmdpdUBob3RtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEF
|
||||
AAOBjQAwgYkCgYEApNj7XXz8T8FcLIWpBniPYom3QcT6T7u0xRPHqtqzj5oboBYp
|
||||
DJe5d354/y0gJTpiLt8+fTrPgWXnbHm3pOHgXzTcX6Arani0GDU0/xDi4VkCRGcS
|
||||
YqX2sJpcDzAbmK9UDMt3xf/O1B8AJan3RfO0Bm3ozTEPziLMkmsiYr5b/L4CAwEA
|
||||
AaOCAfwwggH4MAkGA1UdEwQCMAAwNQYJYIZIAYb4QgENBCgWJkZvciBHcmlkIHVz
|
||||
ZSBvbmx5OyByZXF1ZXN0IHRhZyB1c2VyVGFnMBEGCWCGSAGG+EIBAQQEAwIF4DA/
|
||||
BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vbW9iaWxlLmJsdWUtc29mdHdhcmUucm86
|
||||
OTAvY2EvY3JsLnNodG1sMDUGCWCGSAGG+EIBCAQoFiZodHRwOi8vbW9iaWxlLmJs
|
||||
dWUtc29mdHdhcmUucm86OTAvcHViLzAhBgNVHREEGjAYgRZzZXJnaXVAYmx1ZXNv
|
||||
ZnR3YXJlLnJvMB0GA1UdDgQWBBSwp//5QRXeIzm93TEPl6CyonTg/DCBpwYDVR0j
|
||||
BIGfMIGcoYGWpIGTMIGQMQswCQYDVQQGEwJSTzEQMA4GA1UECBMHUm9tYW5pYTEQ
|
||||
MA4GA1UEBxMHQ3JhaW92YTEPMA0GA1UEChMGU2VyZ2l1MRMwEQYDVQQLEwpTZXJn
|
||||
aXUgU1JMMRIwEAYDVQQDEwlTZXJnaXUgQ0ExIzAhBgkqhkiG9w0BCQEWFG5fc2Vy
|
||||
Z2l1QGhvdG1haWwuY29tggEAMAsGA1UdDwQEAwIE8DAjBglghkgBhvhCAQIEFhYU
|
||||
aHR0cDovLzYyLjIzMS45OC41Mi8wCwYDKgMEBAQ+52I0MA0GCSqGSIb3DQEBBAUA
|
||||
A4GBAIBIOJ+iiLyQfNJEY+IMefayQea0nmuXYY+F+L1DFjSC7xChytgYoPNnKkhh
|
||||
3dWPtxbswiqKYUnGi6y3Hi4UhDsOaDW29t2S305hSc2qgjOiNtRYQIVYQ8EHG1k7
|
||||
Fl63S7uCOhnVJt+4MnUK1N6/pwgsp+Z2GvEsDG1qCKnvNpf6
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #74651: negative-size-param (-1) in memcpy in zif_openssl_seal()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$inputstr = file_get_contents(__DIR__ . "/74651.pem");
|
||||
$pub_key_id = openssl_get_publickey($inputstr);
|
||||
var_dump($pub_key_id);
|
||||
var_dump(openssl_seal($inputstr, $sealed, $ekeys, array($pub_key_id, $pub_key_id), 'AES-128-ECB'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(%d) of type (OpenSSL key)
|
||||
bool(false)
|
||||
@@ -86,8 +86,8 @@ $details = openssl_pkey_get_details($dh);
|
||||
$dh_details = $details['dh'];
|
||||
openssl_pkey_test_cmp($phex, $dh_details['p']);
|
||||
var_dump($dh_details['g']);
|
||||
var_dump(strlen($dh_details['pub_key']));
|
||||
var_dump(strlen($dh_details['priv_key']));
|
||||
var_dump(strlen($dh_details['pub_key']) > 0);
|
||||
var_dump(strlen($dh_details['priv_key']) > 0);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
@@ -102,5 +102,5 @@ int(20)
|
||||
int(128)
|
||||
int(0)
|
||||
string(1) "2"
|
||||
int(128)
|
||||
int(128)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -7274,7 +7274,12 @@ for (;; ptr++)
|
||||
so far in order to get the number. If the name is not found, leave
|
||||
the value of recno as 0 for a forward reference. */
|
||||
|
||||
else
|
||||
/* This patch (removing "else") fixes a problem when a reference is
|
||||
to multiple identically named nested groups from within the nest.
|
||||
Once again, it is not the "proper" fix, and it results in an
|
||||
over-allocation of memory. */
|
||||
|
||||
/* else */
|
||||
{
|
||||
ng = cd->named_groups;
|
||||
for (i = 0; i < cd->names_found; i++, ng++)
|
||||
|
||||
@@ -7307,7 +7307,7 @@ if (opcode == OP_COND || opcode == OP_SCOND)
|
||||
|
||||
if (*matchingpath == OP_FAIL)
|
||||
stacksize = 0;
|
||||
if (*matchingpath == OP_RREF)
|
||||
else if (*matchingpath == OP_RREF)
|
||||
{
|
||||
stacksize = GET2(matchingpath, 1);
|
||||
if (common->currententry == NULL)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
CVE-2016-1283, see bug #75207
|
||||
--FILE--
|
||||
<?php
|
||||
preg_match("/(?:F?+(?:^(?(R)a+\"){99}-))(?J)(?'R'(?'R'<((?'RR'(?'R'\){97)?J)?J)(?'R'(?'R'\){99|(:(?|(?'R')(\k'R')|((?'R')))H'R'R)(H'R))))))/", "*b\dc");
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
Warning: preg_match(): Compilation failed: unmatched parentheses at offset %d in %s on line %d
|
||||
==DONE==
|
||||
@@ -2338,6 +2338,7 @@ void pdo_stmt_init(TSRMLS_D)
|
||||
pdo_row_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; /* when removing this a lot of handlers need to be redone */
|
||||
pdo_row_ce->create_object = pdo_row_new;
|
||||
pdo_row_ce->serialize = pdo_row_serialize;
|
||||
pdo_row_ce->unserialize = zend_class_unserialize_deny;
|
||||
}
|
||||
|
||||
static void free_statement(pdo_stmt_t *stmt TSRMLS_DC)
|
||||
|
||||
@@ -16,6 +16,17 @@ if (count($tmp) < 2)
|
||||
if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
|
||||
die("skip Test cannot be run against remote database server");
|
||||
|
||||
$stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
|
||||
if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
|
||||
if (!is_writable($row['value']))
|
||||
die("skip secure_file_priv directory not writable: {$row['value']}");
|
||||
|
||||
$filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
|
||||
|
||||
if (file_exists($filename) && !is_writable($filename))
|
||||
die("skip {$filename} not writable");
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -16,6 +16,17 @@ if (count($tmp) < 2)
|
||||
if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
|
||||
die("skip Test cannot be run against remote database server");
|
||||
|
||||
$stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
|
||||
if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
|
||||
if (!is_writable($row['value']))
|
||||
die("skip secure_file_priv directory not writable: {$row['value']}");
|
||||
|
||||
$filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
|
||||
|
||||
if (file_exists($filename) && !is_writable($filename))
|
||||
die("skip {$filename} not writable");
|
||||
}
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -115,4 +126,4 @@ Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: %s in %s on li
|
||||
1 => %d,
|
||||
2 => %s,
|
||||
)
|
||||
done!
|
||||
done!
|
||||
+2
-2
@@ -4054,7 +4054,7 @@ PHP_FUNCTION(pg_copy_to)
|
||||
free_pg_null = 1;
|
||||
}
|
||||
|
||||
spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
spprintf(&query, 0, "COPY %s TO STDOUT DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
@@ -4187,7 +4187,7 @@ PHP_FUNCTION(pg_copy_from)
|
||||
pg_null_as_free = 1;
|
||||
}
|
||||
|
||||
spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
spprintf(&query, 0, "COPY %s FROM STDIN DELIMITER E'%c' NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
|
||||
while ((pgsql_result = PQgetResult(pgsql))) {
|
||||
PQclear(pgsql_result);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ else {
|
||||
echo pg_last_error()."\n";
|
||||
}
|
||||
|
||||
// Create view here
|
||||
pg_query($db,$view_def);
|
||||
|
||||
pg_close($db);
|
||||
|
||||
echo "OK";
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug 73498 Incorrect DELIMITER syntax for pg_copy_to()
|
||||
--SKIPIF--
|
||||
<?php include("skipif.inc"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include('config.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
|
||||
$rows = pg_copy_to($db, "(select * from {$view_name})");
|
||||
|
||||
var_dump(gettype($rows));
|
||||
var_dump(count($rows) > 0);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "array"
|
||||
bool(true)
|
||||
@@ -9,6 +9,7 @@ PostgreSQL drop db
|
||||
include('config.inc');
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
pg_query($db, "DROP VIEW {$view_name}");
|
||||
pg_query($db, "DROP TABLE ".$table_name);
|
||||
@pg_query($db, "DROP TABLE ".$table_name_92);
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ $table_name = "php_pgsql_test"; // test table that will be created
|
||||
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
|
||||
$num_test_record = 1000; // Number of records to create
|
||||
|
||||
// Test view
|
||||
$view_name = "php_pgsql_viewtest";
|
||||
$view_def = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};";
|
||||
|
||||
// Test table
|
||||
$table_def = "CREATE TABLE ${table_name} (num int, str text, bin bytea);";
|
||||
$table_def_92 = "CREATE TABLE ${table_name_92} (textary text[], jsn json);";
|
||||
|
||||
+3
-4
@@ -981,7 +981,6 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
/* if the alias is stored we enforce it (implicit overrides explicit) */
|
||||
if (alias && alias_len && (alias_len != (int)tmp_len || strncmp(alias, buffer, tmp_len)))
|
||||
{
|
||||
buffer[tmp_len] = '\0';
|
||||
php_stream_close(fp);
|
||||
|
||||
if (signature) {
|
||||
@@ -989,7 +988,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
}
|
||||
|
||||
if (error) {
|
||||
spprintf(error, 0, "cannot load phar \"%s\" with implicit alias \"%s\" under different alias \"%s\"", fname, buffer, alias);
|
||||
spprintf(error, 0, "cannot load phar \"%s\" with implicit alias \"%.*s\" under different alias \"%s\"", fname, tmp_len, buffer, alias);
|
||||
}
|
||||
|
||||
efree(savebuf);
|
||||
@@ -1055,7 +1054,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
entry.is_persistent = mydata->is_persistent;
|
||||
|
||||
for (manifest_index = 0; manifest_index < manifest_count; ++manifest_index) {
|
||||
if (buffer + 4 > endbuffer) {
|
||||
if (buffer + 28 > endbuffer) {
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)")
|
||||
}
|
||||
|
||||
@@ -1069,7 +1068,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
entry.manifest_pos = manifest_index;
|
||||
}
|
||||
|
||||
if (entry.filename_len + 20 > endbuffer - buffer) {
|
||||
if (entry.filename_len > endbuffer - buffer - 24) {
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ if (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File Not Found</h1>\n </body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
|
||||
+2
-2
@@ -22,13 +22,13 @@ static inline void phar_get_stub(const char *index_php, const char *web, size_t
|
||||
{
|
||||
static const char newstub0[] = "<?php\n\n$web = '";
|
||||
static const char newstub1_0[] = "';\n\nif (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {\nPhar::interceptFileFuncs();\nset_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());\nPhar::webPhar(null, $web);\ninclude 'phar://' . __FILE__ . '/' . Extract_Phar::START;\nreturn;\n}\n\nif (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST'))) {\nExtract_Phar::go(true);\n$mimes = array(\n'phps' => 2,\n'c' => 'text/plain',\n'cc' => 'text/plain',\n'cpp' => 'text/plain',\n'c++' => 'text/plain',\n'dtd' => 'text/plain',\n'h' => 'text/plain',\n'log' => 'text/plain',\n'rng' => 'text/plain',\n'txt' => 'text/plain',\n'xsd' => 'text/plain',\n'php' => 1,\n'inc' => 1,\n'avi' => 'video/avi',\n'bmp' => 'image/bmp',\n'css' => 'text/css',\n'gif' => 'image/gif',\n'htm' => 'text/html',\n'html' => 'text/html',\n'htmls' => 'text/html',\n'ico' => 'image/x-ico',\n'jpe' => 'image/jpeg',\n'jpg' => 'image/jpeg',\n'jpeg' => 'image/jpeg',\n'js' => 'application/x-javascript',\n'midi' => 'audio/midi',\n'mid' => 'audio/midi',\n'mod' => 'audio/mod',\n'mov' => 'movie/quicktime',\n'mp3' => 'audio/mp3',\n'mpg' => 'video/mpeg',\n'mpeg' => 'video/mpeg',\n'pdf' => 'application/pdf',\n'png' => 'image/png',\n'swf' => 'application/shockwave-flash',\n'tif' => 'image/tiff',\n'tiff' => 'image/tiff',\n'wav' => 'audio/wav',\n'xbm' => 'image/xbm',\n'xml' => 'text/xml',\n);\n\nheader(\"Cache-Control: no-cache, must-revalidate\");\nheader(\"Pragma: no-cache\");\n\n$basename = basename(__FILE__);\nif (!strpos($_SERVER['REQUEST_URI'], $basename)) {\nchdir(Extract_Phar::$temp);\ninclude $web;\nreturn;\n}\n$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));\nif (!$pt || $pt == '/') {\n$pt = $web;\nheader('HTTP/1.1 301 Moved Permanently');\nheader('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);\nexit;\n}\n$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);\nif (!$a || strlen(dirname($a)) < strlen(";
|
||||
static const char newstub1_1[] = "Extract_Phar::$temp)) {\nheader('HTTP/1.0 404 Not Found');\necho \"<html>\\n <head>\\n <title>File Not Found<title>\\n </head>\\n <body>\\n <h1>404 - File \", $pt, \" Not Found</h1>\\n </body>\\n</html>\";\nexit;\n}\n$b = pathinfo($a);\nif (!isset($b['extension'])) {\nheader('Content-Type: text/plain');\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\nif (isset($mimes[$b['extension']])) {\nif ($mimes[$b['extension']] === 1) {\ninclude $a;\nexit;\n}\nif ($mimes[$b['extension']] === 2) {\nhighlight_file($a);\nexit;\n}\nheader('Content-Type: ' .$mimes[$b['extension']]);\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\n}\n\nclass Extract_Phar\n{\nstatic $temp;\nstatic $origdir;\nconst GZ = 0x1000;\nconst BZ2 = 0x2000;\nconst MASK = 0x3000;\nconst START = '";
|
||||
static const char newstub1_1[] = "Extract_Phar::$temp)) {\nheader('HTTP/1.0 404 Not Found');\necho \"<html>\\n <head>\\n <title>File Not Found<title>\\n </head>\\n <body>\\n <h1>404 - File Not Found</h1>\\n </body>\\n</html>\";\nexit;\n}\n$b = pathinfo($a);\nif (!isset($b['extension'])) {\nheader('Content-Type: text/plain');\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\nif (isset($mimes[$b['extension']])) {\nif ($mimes[$b['extension']] === 1) {\ninclude $a;\nexit;\n}\nif ($mimes[$b['extension']] === 2) {\nhighlight_file($a);\nexit;\n}\nheader('Content-Type: ' .$mimes[$b['extension']]);\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\n}\n\nclass Extract_Phar\n{\nstatic $temp;\nstatic $origdir;\nconst GZ = 0x1000;\nconst BZ2 = 0x2000;\nconst MASK = 0x3000;\nconst START = '";
|
||||
static const char newstub2[] = "';\nconst LEN = ";
|
||||
static const char newstub3_0[] = ";\n\nstatic function go($return = false)\n{\n$fp = fopen(__FILE__, 'rb');\nfseek($fp, self::LEN);\n$L = unpack('V', $a = (binary)fread($fp, 4));\n$m = (binary)'';\n\ndo {\n$read = 8192;\nif ($L[1] - strlen($m) < 8192) {\n$read = $L[1] - strlen($m);\n}\n$last = (binary)fread($fp, $read);\n$m .= $last;\n} while (strlen($last) && strlen($m) < $L[1]);\n\nif (strlen($m) < $L[1]) {\ndie('ERROR: manifest length read was \"' .\nstrlen($m) .'\" should be \"' .\n$L[1] . '\"');\n}\n\n$info = self::_unpack($m);\n$f = $info['c'];\n\nif ($f & self::GZ) {\nif (!function_exists('gzinflate')) {\ndie('Error: zlib extension is not enabled -' .\n' gzinflate() function needed for zlib-compressed .phars');\n}\n}\n\nif ($f & self::BZ2) {\nif (!function_exists('bzdecompress')) {\ndie('Error: bzip2 extension is not enabled -' .\n' bzdecompress() function needed for bz2-compressed .phars');\n}\n}\n\n$temp = self::tmpdir();\n\nif (!$temp || !is_writable($temp)) {\n$sessionpath = session_save_path();\nif (strpos ($sessionpath, \";\") !== false)\n$sessionpath = substr ($sessionpath, strpos ($sessionpath, \";\")+1);\nif (!file_exists($sessionpath) || !is_dir($sessionpath)) {\ndie('Could not locate temporary directory to extract phar');\n}\n$temp = $sessionpath;\n}\n\n$temp .= '/pharextract/'.basename(__FILE__, '.phar');\nself::$temp = $temp;\nself::$origdir = getcwd();\n@mkdir($temp, 0777, true);\n$temp = realpath($temp);\n\nif (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {\nself::_removeTmpFiles($temp, getcwd());\n@mkdir($temp, 0777, true);\n@file_put_contents($temp . '/' . md5_file(__FILE__), '');\n\nforeach ($info['m'] as $path => $file) {\n$a = !file_exists(dirname($temp . '/' . $path));\n@mkdir(dirname($temp . '/' . $path), 0777, true);\nclearstatcache();\n\nif ($path[strlen($path) - 1] == '/') {\n@mkdir($temp . '/' . $path, 0777);\n} else {\nfile_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));\n@chmod($temp . '/' . $path, 0666);\n}\n}\n}\n\nchdir($temp);\n\nif (!$return) {\ninclude self::ST";
|
||||
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);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Phar: PHP bug #73764: Crash while loading hostile phar archive
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
chdir(__DIR__);
|
||||
try {
|
||||
$p = Phar::LoadPhar('bug73764.phar', 'alias.phar');
|
||||
echo "OK\n";
|
||||
} catch(PharException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
internal corruption of phar "%sbug73764.phar" (truncated manifest entry)
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Phar: PHP bug #73768: Memory corruption when loading hostile phar
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
chdir(__DIR__);
|
||||
try {
|
||||
$p = Phar::LoadPhar('bug73768.phar', 'alias.phar');
|
||||
echo "OK\n";
|
||||
} catch(PharException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
cannot load phar "%sbug73768.phar" with implicit alias "" under different alias "alias.phar"
|
||||
@@ -18,5 +18,5 @@ echo strlen($p2->getStub()),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER(); ?>
|
||||
"
|
||||
6685
|
||||
6675
|
||||
ok
|
||||
@@ -29,7 +29,7 @@ unlink(dirname(__FILE__) . '/brandnewphar.phar');
|
||||
__HALT_COMPILER();
|
||||
?>
|
||||
--EXPECT--
|
||||
int(6683)
|
||||
int(6673)
|
||||
string(200) "<?php
|
||||
function __autoload($class)
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ NULL
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
int(6683)
|
||||
int(6673)
|
||||
NULL
|
||||
================= convertToZip() =====================
|
||||
bool(false)
|
||||
|
||||
@@ -32,7 +32,7 @@ __HALT_COMPILER();
|
||||
unlink(dirname(__FILE__) . '/brandnewphar.phar');
|
||||
?>
|
||||
--EXPECT--
|
||||
int(6683)
|
||||
int(6673)
|
||||
string(200) "<?php
|
||||
function __autoload($class)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ echo $e->getMessage() . "\n";
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(6683) "<?php
|
||||
string(6673) "<?php
|
||||
|
||||
$web = 'index.php';
|
||||
|
||||
@@ -110,7 +110,7 @@ exit;
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File Not Found</h1>\n </body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
@@ -144,7 +144,7 @@ const GZ = 0x1000;
|
||||
const BZ2 = 0x2000;
|
||||
const MASK = 0x3000;
|
||||
const START = 'index.php';
|
||||
const LEN = 6685;
|
||||
const LEN = 6675;
|
||||
|
||||
static function go($return = false)
|
||||
{
|
||||
@@ -328,7 +328,7 @@ Extract_Phar::go();
|
||||
__HALT_COMPILER(); ?>"
|
||||
============================================================================
|
||||
============================================================================
|
||||
string(6694) "<?php
|
||||
string(6684) "<?php
|
||||
|
||||
$web = 'index.php';
|
||||
|
||||
@@ -404,7 +404,7 @@ exit;
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File Not Found</h1>\n </body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
@@ -438,7 +438,7 @@ const GZ = 0x1000;
|
||||
const BZ2 = 0x2000;
|
||||
const MASK = 0x3000;
|
||||
const START = 'my/custom/thingy.php';
|
||||
const LEN = 6696;
|
||||
const LEN = 6686;
|
||||
|
||||
static function go($return = false)
|
||||
{
|
||||
@@ -622,7 +622,7 @@ Extract_Phar::go();
|
||||
__HALT_COMPILER(); ?>"
|
||||
============================================================================
|
||||
============================================================================
|
||||
int(7074)
|
||||
int(7064)
|
||||
============================================================================
|
||||
============================================================================
|
||||
Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
|
||||
@@ -630,7 +630,7 @@ Illegal filename passed in for stub creation, was 401 characters long, and only
|
||||
============================================================================
|
||||
============================================================================
|
||||
============================================================================
|
||||
string(6696) "<?php
|
||||
string(6686) "<?php
|
||||
|
||||
$web = 'the/web.php';
|
||||
|
||||
@@ -706,7 +706,7 @@ exit;
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File Not Found</h1>\n </body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
@@ -740,7 +740,7 @@ const GZ = 0x1000;
|
||||
const BZ2 = 0x2000;
|
||||
const MASK = 0x3000;
|
||||
const START = 'my/custom/thingy.php';
|
||||
const LEN = 6698;
|
||||
const LEN = 6688;
|
||||
|
||||
static function go($return = false)
|
||||
{
|
||||
@@ -924,6 +924,6 @@ Extract_Phar::go();
|
||||
__HALT_COMPILER(); ?>"
|
||||
============================================================================
|
||||
============================================================================
|
||||
int(7074)
|
||||
int(7064)
|
||||
Illegal web filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
|
||||
===DONE===
|
||||
@@ -70,8 +70,8 @@ var_dump($phar->getAlias());
|
||||
Entry .phar/stub.php does not exist
|
||||
Entry .phar/alias.txt does not exist
|
||||
Cannot set stub ".phar/stub.php" directly in phar "%sphar_offset_check.phar.php", use setStub
|
||||
int(6685)
|
||||
int(6685)
|
||||
int(6675)
|
||||
int(6675)
|
||||
Cannot set alias ".phar/alias.txt" directly in phar "%sphar_offset_check.phar.php", use setAlias
|
||||
string(5) "susan"
|
||||
string(5) "susan"
|
||||
|
||||
@@ -54,7 +54,7 @@ try {
|
||||
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6685) "<?php
|
||||
string(6675) "<?php
|
||||
|
||||
$web = 'index.php';
|
||||
|
||||
@@ -130,7 +130,7 @@ exit;
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File Not Found</h1>\n </body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
@@ -164,7 +164,7 @@ const GZ = 0x1000;
|
||||
const BZ2 = 0x2000;
|
||||
const MASK = 0x3000;
|
||||
const START = 'index.php';
|
||||
const LEN = 6685;
|
||||
const LEN = 6675;
|
||||
|
||||
static function go($return = false)
|
||||
{
|
||||
@@ -349,7 +349,7 @@ __HALT_COMPILER(); ?>
|
||||
"
|
||||
============================================================================
|
||||
============================================================================
|
||||
string(6696) "<?php
|
||||
string(6686) "<?php
|
||||
|
||||
$web = 'index.php';
|
||||
|
||||
@@ -425,7 +425,7 @@ exit;
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File Not Found</h1>\n </body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
@@ -459,7 +459,7 @@ const GZ = 0x1000;
|
||||
const BZ2 = 0x2000;
|
||||
const MASK = 0x3000;
|
||||
const START = 'my/custom/thingy.php';
|
||||
const LEN = 6696;
|
||||
const LEN = 6686;
|
||||
|
||||
static function go($return = false)
|
||||
{
|
||||
@@ -644,7 +644,7 @@ __HALT_COMPILER(); ?>
|
||||
"
|
||||
============================================================================
|
||||
============================================================================
|
||||
string(6698) "<?php
|
||||
string(6688) "<?php
|
||||
|
||||
$web = 'the/web.php';
|
||||
|
||||
@@ -720,7 +720,7 @@ exit;
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>";
|
||||
echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File Not Found</h1>\n </body>\n</html>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
@@ -754,7 +754,7 @@ const GZ = 0x1000;
|
||||
const BZ2 = 0x2000;
|
||||
const MASK = 0x3000;
|
||||
const START = 'my/custom/thingy.php';
|
||||
const LEN = 6698;
|
||||
const LEN = 6688;
|
||||
|
||||
static function go($return = false)
|
||||
{
|
||||
@@ -939,6 +939,6 @@ __HALT_COMPILER(); ?>
|
||||
"
|
||||
============================================================================
|
||||
============================================================================
|
||||
int(7076)
|
||||
int(7066)
|
||||
Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
|
||||
===DONE===
|
||||
@@ -47,12 +47,12 @@ __HALT_COMPILER();
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
string(60) "<?php // tar-based phar archive stub file
|
||||
__HALT_COMPILER();"
|
||||
bool(true)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
int(6683)
|
||||
int(6673)
|
||||
===DONE===
|
||||
@@ -49,14 +49,14 @@ __HALT_COMPILER();
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
string(60) "<?php // tar-based phar archive stub file
|
||||
__HALT_COMPILER();"
|
||||
bool(true)
|
||||
int(4096)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(6683)
|
||||
int(6673)
|
||||
===DONE===
|
||||
@@ -49,14 +49,14 @@ __HALT_COMPILER();
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
string(60) "<?php // tar-based phar archive stub file
|
||||
__HALT_COMPILER();"
|
||||
bool(true)
|
||||
int(8192)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(6683)
|
||||
int(6673)
|
||||
===DONE===
|
||||
@@ -54,7 +54,7 @@ __HALT_COMPILER();
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(6683)
|
||||
int(6673)
|
||||
string(2) "hi"
|
||||
bool(true)
|
||||
string(60) "<?php // tar-based phar archive stub file
|
||||
@@ -62,10 +62,10 @@ __HALT_COMPILER();"
|
||||
string(2) "hi"
|
||||
bool(true)
|
||||
int(4096)
|
||||
int(6683)
|
||||
int(6673)
|
||||
string(2) "hi"
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(6683)
|
||||
int(6673)
|
||||
string(2) "hi"
|
||||
===DONE===
|
||||
@@ -46,12 +46,12 @@ __HALT_COMPILER();
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
string(60) "<?php // zip-based phar archive stub file
|
||||
__HALT_COMPILER();"
|
||||
bool(true)
|
||||
int(6683)
|
||||
int(6673)
|
||||
bool(true)
|
||||
int(6683)
|
||||
int(6673)
|
||||
===DONE===
|
||||
+26
-5
@@ -904,6 +904,7 @@ PHP_METHOD(SoapFault, SoapFault)
|
||||
PHP_METHOD(SoapFault, __toString)
|
||||
{
|
||||
zval *faultcode, *faultstring, *file, *line, *trace;
|
||||
zval *faultcode_cp, *faultstring_cp, *file_cp, *line_cp;
|
||||
char *str;
|
||||
int len;
|
||||
zend_fcall_info fci;
|
||||
@@ -932,16 +933,36 @@ PHP_METHOD(SoapFault, __toString)
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
convert_to_string(faultcode);
|
||||
convert_to_string(faultstring);
|
||||
convert_to_string(file);
|
||||
convert_to_long(line);
|
||||
ALLOC_ZVAL(faultcode_cp);
|
||||
INIT_PZVAL_COPY(faultcode_cp, faultcode);
|
||||
zval_copy_ctor(faultcode_cp);
|
||||
|
||||
ALLOC_ZVAL(faultstring_cp);
|
||||
INIT_PZVAL_COPY(faultstring_cp, faultstring);
|
||||
zval_copy_ctor(faultstring_cp);
|
||||
|
||||
ALLOC_ZVAL(file_cp);
|
||||
INIT_PZVAL_COPY(file_cp, file);
|
||||
zval_copy_ctor(file_cp);
|
||||
|
||||
ALLOC_ZVAL(line_cp);
|
||||
INIT_PZVAL_COPY(line_cp, line);
|
||||
zval_copy_ctor(line_cp);
|
||||
|
||||
convert_to_string(faultcode_cp);
|
||||
convert_to_string(faultstring_cp);
|
||||
convert_to_string(file_cp);
|
||||
convert_to_long(line_cp);
|
||||
convert_to_string(trace);
|
||||
|
||||
len = spprintf(&str, 0, "SoapFault exception: [%s] %s in %s:%ld\nStack trace:\n%s",
|
||||
Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_LVAL_P(line),
|
||||
Z_STRVAL_P(faultcode_cp), Z_STRVAL_P(faultstring_cp), Z_STRVAL_P(file_cp), Z_LVAL_P(line_cp),
|
||||
Z_STRLEN_P(trace) ? Z_STRVAL_P(trace) : "#0 {main}\n");
|
||||
|
||||
zval_ptr_dtor(&faultcode_cp);
|
||||
zval_ptr_dtor(&faultstring_cp);
|
||||
zval_ptr_dtor(&file_cp);
|
||||
zval_ptr_dtor(&line_cp);
|
||||
zval_ptr_dtor(&trace);
|
||||
|
||||
RETURN_STRINGL(str, len, 0);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #73452 Segfault (Regression for #69152)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$data = 'O:9:"SoapFault":4:{s:9:"faultcode";i:4298448493;s:11:"faultstring";i:4298448543;s:7:"'."\0*\0".'file";i:4298447319;s:7:"'."\0*\0".'line";s:4:"ryat";}';
|
||||
echo unserialize($data);
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
SoapFault exception: [4298448493] 4298448543 in :0
|
||||
Stack trace:
|
||||
#0 %sbug73452.php(4): unserialize('O:9:"SoapFault"...')
|
||||
#1 {main}==DONE==
|
||||
+1
-1
@@ -1812,7 +1812,7 @@ SPL_METHOD(Array, unserialize)
|
||||
ALLOC_INIT_ZVAL(intern->array);
|
||||
if (!php_var_unserialize(&intern->array, &p, s + buf_len, &var_hash TSRMLS_CC)
|
||||
|| (Z_TYPE_P(intern->array) != IS_ARRAY && Z_TYPE_P(intern->array) != IS_OBJECT)) {
|
||||
zval_ptr_dtor(&intern->array);
|
||||
// zval_ptr_dtor(&intern->array);
|
||||
goto outexcept;
|
||||
}
|
||||
var_push_dtor(&var_hash, &intern->array);
|
||||
|
||||
+5
-5
@@ -133,7 +133,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_
|
||||
|
||||
if (type != 3) {
|
||||
b = buf;
|
||||
|
||||
|
||||
while (php_stream_get_line(stream, b, EXEC_INPUT_BUF, &bufl)) {
|
||||
/* no new line found, let's read some more */
|
||||
if (b[bufl - 1] != '\n' && !php_stream_eof(stream)) {
|
||||
@@ -330,7 +330,7 @@ PHPAPI char *php_escape_shell_cmd(char *str)
|
||||
cmd[y++] = str[x];
|
||||
break;
|
||||
#else
|
||||
/* % is Windows specific for enviromental variables, ^%PATH% will
|
||||
/* % is Windows specific for enviromental variables, ^%PATH% will
|
||||
output PATH while ^%PATH^% will not. escapeshellcmd will escape all % and !.
|
||||
*/
|
||||
case '%':
|
||||
@@ -492,7 +492,7 @@ PHP_FUNCTION(escapeshellcmd)
|
||||
return;
|
||||
}
|
||||
cmd = php_escape_shell_cmd(command);
|
||||
RETVAL_STRING(cmd, 0);
|
||||
RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0);
|
||||
} else {
|
||||
RETVAL_EMPTY_STRING();
|
||||
}
|
||||
@@ -517,7 +517,7 @@ PHP_FUNCTION(escapeshellarg)
|
||||
return;
|
||||
}
|
||||
cmd = php_escape_shell_arg(argument);
|
||||
RETVAL_STRING(cmd, 0);
|
||||
RETVAL_STRINGL_CHECK(cmd, strlen(cmd), 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -551,7 +551,7 @@ PHP_FUNCTION(shell_exec)
|
||||
php_stream_close(stream);
|
||||
|
||||
if (total_readbytes > 0) {
|
||||
RETVAL_STRINGL(ret, total_readbytes, 0);
|
||||
RETVAL_STRINGL_CHECK(ret, total_readbytes, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -699,6 +699,24 @@ finish:
|
||||
if ((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) {
|
||||
reqok = 1;
|
||||
}
|
||||
|
||||
/* status codes of 1xx are "informational", and will be followed by a real response
|
||||
* e.g "100 Continue". RFC 7231 states that unexpected 1xx status MUST be parsed,
|
||||
* and MAY be ignored. As such, we need to skip ahead to the "real" status*/
|
||||
if (response_code >= 100 && response_code < 200) {
|
||||
/* consume lines until we find a line starting 'HTTP/1' */
|
||||
while (
|
||||
!php_stream_eof(stream)
|
||||
&& php_stream_get_line(stream, tmp_line, sizeof(tmp_line) - 1, &tmp_line_len) != NULL
|
||||
&& ( tmp_line_len < sizeof("HTTP/1") - 1 || strncasecmp(tmp_line, "HTTP/1", sizeof("HTTP/1") - 1) )
|
||||
);
|
||||
|
||||
if (tmp_line_len > 9) {
|
||||
response_code = atoi(tmp_line + 9);
|
||||
} else {
|
||||
response_code = 0;
|
||||
}
|
||||
}
|
||||
/* all status codes in the 2xx range are defined by the specification as successful;
|
||||
* all status codes in the 3xx range are for redirection, and so also should never
|
||||
* fail */
|
||||
|
||||
Loaded 100 of 156 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user