mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-12 11:40:50 +00:00
Compare commits
65
Commits
PHP-5.6.31
...
php-5.6.40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b8f72da5d | ||
|
|
05fb101650 | ||
|
|
9d6c59eeea | ||
|
|
b51eaf4166 | ||
|
|
c95daa9c75 | ||
|
|
7a12dad4dd | ||
|
|
1cc2182bcc | ||
|
|
28362ed4fa | ||
|
|
20407d06ca | ||
|
|
a918020c03 | ||
|
|
428d8164ff | ||
|
|
4fc0bceb7c | ||
|
|
f51062523d | ||
|
|
c26cb383a5 | ||
|
|
78bffa72c1 | ||
|
|
48f0f73f75 | ||
|
|
7edc639b9f | ||
|
|
aabdb71dc3 | ||
|
|
0382e761d7 | ||
|
|
2fba1e2f59 | ||
|
|
69f5e7992b | ||
|
|
d8765852e0 | ||
|
|
e5bfea64c8 | ||
|
|
81f23057dc | ||
|
|
c1de84014d | ||
|
|
23b057742e | ||
|
|
1ba3314335 | ||
|
|
b73a108543 | ||
|
|
289cb0f77c | ||
|
|
3462efa386 | ||
|
|
1baeae4270 | ||
|
|
fe3d53f443 | ||
|
|
4371af3e19 | ||
|
|
ee76a5ae5a | ||
|
|
58b0003975 | ||
|
|
a4c55eefd0 | ||
|
|
6e64aba47f | ||
|
|
e2dcf3cc54 | ||
|
|
8dca5ae5ec | ||
|
|
49782c5499 | ||
|
|
06d309fd7a | ||
|
|
b4e4788c44 | ||
|
|
cb981e39c2 | ||
|
|
2885f62816 | ||
|
|
d20bebfe13 | ||
|
|
3db7427b71 | ||
|
|
4698a412bf | ||
|
|
523f230c83 | ||
|
|
1f4b057b63 | ||
|
|
36239fee36 | ||
|
|
67ec3ce1ec | ||
|
|
028507f1f6 | ||
|
|
2881199c80 | ||
|
|
8d6e958867 | ||
|
|
73ca9b3773 | ||
|
|
f6e8ce8121 | ||
|
|
f600785f65 | ||
|
|
ad7ed6fe21 | ||
|
|
787e3a1ee4 | ||
|
|
9839d3a953 | ||
|
|
45ac5edbd9 | ||
|
|
7d06a5c89f | ||
|
|
37acebcc8c | ||
|
|
a7815e63bd | ||
|
|
d37658be6c |
No files matched your search
@@ -1,3 +1,4 @@
|
||||
dist: precise
|
||||
language: c
|
||||
sudo: false
|
||||
addons:
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: fpm
|
||||
PRIMARY MAINTAINER: Antony Dovgal <tony2001@php.net>, Jerome Loyet <fat@php.net>
|
||||
PRIMARY MAINTAINER: Jakub Zelenka <bukka@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.3.3
|
||||
|
||||
@@ -1,6 +1,107 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ?? 2017, PHP 5.6.32
|
||||
10 Jan 2019, PHP 5.6.40
|
||||
|
||||
- GD:
|
||||
. Fixed bug #77269 (efree() on uninitialized Heap data in imagescale leads to
|
||||
use-after-free). (cmb)
|
||||
. Fixed bug #77270 (imagecolormatch Out Of Bounds Write on Heap). (cmb)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #77370 (Buffer overflow on mb regex functions - fetch_token). (Stas)
|
||||
. Fixed bug #77371 (heap buffer overflow in mb regex functions
|
||||
- compile_string_node). (Stas)
|
||||
. Fixed bug #77381 (heap buffer overflow in multibyte match_at). (Stas)
|
||||
. Fixed bug #77382 (heap buffer overflow due to incorrect length in
|
||||
expand_case_fold_string). (Stas)
|
||||
. Fixed bug #77385 (buffer overflow in fetch_token). (Stas)
|
||||
. Fixed bug #77394 (Buffer overflow in multibyte case folding - unicode). (Stas)
|
||||
. Fixed bug #77418 (Heap overflow in utf32be_mbc_to_code). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext). (Stas)
|
||||
|
||||
- Xmlrpc:
|
||||
. Fixed bug #77242 (heap out of bounds read in xmlrpc_decode()). (cmb)
|
||||
. Fixed bug #77380 (Global out of bounds read in xmlrpc base64 code). (Stas)
|
||||
|
||||
06 Dec 2018, PHP 5.6.39
|
||||
|
||||
- Core:
|
||||
. Fixed bug #77231 (Segfault when using convert.quoted-printable-encode
|
||||
filter). (Stas)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #77020 (null pointer dereference in imap_mail). (cmb)
|
||||
. Fixed bug #77153 (imap_open allows to run arbitrary shell commands via
|
||||
mailbox parameter). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #77022 (PharData always creates new files with mode 0666). (Stas)
|
||||
. Fixed bug #77143 (Heap Buffer Overflow (READ: 4) in phar_parse_pharfile).
|
||||
(Stas)
|
||||
|
||||
13 Sep 2018, PHP 5.6.38
|
||||
|
||||
- Apache2
|
||||
. Fixed bug #76582 (XSS due to the header Transfer-Encoding: chunked). (Stas)
|
||||
|
||||
19 Jul 2018, PHP 5.6.37
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #76423 (Int Overflow lead to Heap OverFlow in
|
||||
exif_thumbnail_extract of exif.c). (Stas)
|
||||
. Fixed bug #76557 (heap-buffer-overflow (READ of size 48) while reading exif
|
||||
data). (Stas)
|
||||
|
||||
- Win32:
|
||||
. Fixed bug #76459 (windows linkinfo lacks openbasedir check). (Anatol)
|
||||
|
||||
26 Apr 2018 PHP 5.6.36
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #76130 (Heap Buffer Overflow (READ: 1786) in exif_iif_add_value).
|
||||
(Stas)
|
||||
|
||||
- iconv:
|
||||
. Fixed bug #76249 (stream filter convert.iconv leads to infinite loop on
|
||||
invalid sequence). (Stas)
|
||||
|
||||
- LDAP:
|
||||
. Fixed bug #76248 (Malicious LDAP-Server Response causes Crash). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #76129 (fix for CVE-2018-5712 may not be complete). (Stas)
|
||||
|
||||
29 Mar 2018, PHP 5.6.35
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #75605 (Dumpable FPM child processes allow bypassing opcache
|
||||
access controls). (Jakub Zelenka)
|
||||
|
||||
01 Mar 2018, PHP 5.6.34
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #75981 (stack-buffer-overflow while parsing HTTP response). (Stas)
|
||||
|
||||
04 Jan 2018, 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
|
||||
|
||||
@@ -11,7 +112,7 @@ PHP NEWS
|
||||
unserialize). (Nikita)
|
||||
. Fixed bug #74603 (PHP INI Parsing Stack Buffer Overflow Vulnerability).
|
||||
(Stas)
|
||||
. Fixed bug #74819 (wddx_deserialize() heap out-of-bound read via
|
||||
. Fixed bug #74819 (wddx_deserialize() heap out-of-bound read via
|
||||
php_parse_date()). (Derick)
|
||||
|
||||
- GD:
|
||||
|
||||
@@ -64,6 +64,13 @@ PHP 5.6 UPGRADE NOTES
|
||||
- cURL:
|
||||
Uploads using the @file syntax are now unsupported by default.
|
||||
|
||||
- IMAP:
|
||||
Starting with 5.6.38, rsh/ssh logins are disabled by default. Use
|
||||
imap.enable_insecure_rsh if you want to enable them. Note that the IMAP
|
||||
library does not filter mailbox names before passing them to rsh/ssh
|
||||
command, thus passing untrusted data to this function with rsh/ssh enabled
|
||||
is insecure.
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
========================================
|
||||
|
||||
+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=32
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=40
|
||||
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`
|
||||
|
||||
|
||||
+2423
-836
File diff suppressed because it is too large.
Load diff
@@ -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;
|
||||
|
||||
@@ -40,7 +40,7 @@ object(DateInterval)#%d (15) {
|
||||
["special_amount"]=>
|
||||
int(-1)
|
||||
["have_weekday_relative"]=>
|
||||
int(9)
|
||||
int(%d)
|
||||
["have_special_relative"]=>
|
||||
int(0)
|
||||
}
|
||||
|
||||
+9
-3
@@ -1710,7 +1710,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
case TAG_FMT_UNDEFINED:
|
||||
if (value) {
|
||||
if (tag == TAG_MAKER_NOTE) {
|
||||
length = MIN(length, strlen(value));
|
||||
length = (int) php_strnlen(value, length);
|
||||
}
|
||||
|
||||
/* do not recompute length here */
|
||||
@@ -2545,7 +2545,10 @@ static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, siz
|
||||
return;
|
||||
}
|
||||
/* Check to make sure we are not going to go past the ExifLength */
|
||||
if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) {
|
||||
if (ImageInfo->Thumbnail.size > length
|
||||
|| (ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length
|
||||
|| ImageInfo->Thumbnail.offset > length - ImageInfo->Thumbnail.size
|
||||
) {
|
||||
EXIF_ERRLOG_THUMBEOF(ImageInfo)
|
||||
return;
|
||||
}
|
||||
@@ -2725,6 +2728,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
int NumDirEntries, old_motorola_intel, offset_diff;
|
||||
const maker_note_type *maker_note;
|
||||
char *dir_start;
|
||||
int data_len;
|
||||
|
||||
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
|
||||
@@ -2779,6 +2783,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
switch (maker_note->offset_mode) {
|
||||
case MN_OFFSET_MAKER:
|
||||
offset_base = value_ptr;
|
||||
data_len = value_len;
|
||||
break;
|
||||
case MN_OFFSET_GUESS:
|
||||
if (maker_note->offset + 10 + 4 >= value_len) {
|
||||
@@ -2795,6 +2800,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
return FALSE;
|
||||
}
|
||||
offset_base = value_ptr + offset_diff;
|
||||
data_len = value_len - offset_diff;
|
||||
break;
|
||||
default:
|
||||
case MN_OFFSET_NORMAL:
|
||||
@@ -2808,7 +2814,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
|
||||
for (de=0;de<NumDirEntries;de++) {
|
||||
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
|
||||
offset_base, IFDlength, displacement, section_index, 0, maker_note->tag_table TSRMLS_CC)) {
|
||||
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table TSRMLS_CC)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #76130 (Heap Buffer Overflow (READ: 1786) in exif_iif_add_value)
|
||||
--DESCRIPTION--
|
||||
This test is meant to exhibit memory issues with the `-m` option. Since a lot of
|
||||
notices and warnings are to be expected anyway, we suppress these, since the are
|
||||
not relevant for this test.
|
||||
--INI--
|
||||
error_reporting=E_ALL & ~E_WARNING & ~E_NOTICE
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__ . '/bug76130_1.jpg');
|
||||
exif_read_data(__DIR__ . '/bug76130_2.jpg');
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #76423 (Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('exif')) die('skip exif extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__ . '/bug76423.jpg', 0, true, true);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Thumbnail goes IFD boundary or end of file reached in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): File structure corrupted in %s on line %d
|
||||
|
||||
Warning: exif_read_data(%s.jpg): Invalid JPEG file in %s on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,79 @@
|
||||
--TEST--
|
||||
Bug 76557 (heap-buffer-overflow (READ of size 48) while reading exif data)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(count(exif_read_data(dirname(__FILE__) . "/bug76557.jpg")));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x010F=Make ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x8769=Exif_IFD_Po): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x927C=MakerNote ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > x00EE) in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): File structure corrupted in %sbug76557.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug76557.jpg): Invalid JPEG file in %sbug76557.php on line %d
|
||||
int(1)
|
||||
DONE
|
||||
@@ -33,8 +33,8 @@ int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2)
|
||||
return -4; /* At least 1 color must be allocated */
|
||||
}
|
||||
|
||||
buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * im2->colorsTotal, 0);
|
||||
memset( buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal );
|
||||
buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * gdMaxColors, 0);
|
||||
memset( buf, 0, sizeof(unsigned long) * 5 * gdMaxColors );
|
||||
|
||||
for (x=0; x<im1->sx; x++) {
|
||||
for( y=0; y<im1->sy; y++ ) {
|
||||
|
||||
@@ -261,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 */
|
||||
@@ -275,6 +271,10 @@ terminated:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!im->colorsTotal) {
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
}
|
||||
return im;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -375,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;
|
||||
|
||||
@@ -880,8 +880,13 @@ static inline LineContribType * _gdContributionsAlloc(unsigned int line_length,
|
||||
{
|
||||
unsigned int u = 0;
|
||||
LineContribType *res;
|
||||
int overflow_error = 0;
|
||||
size_t weights_size;
|
||||
|
||||
if (overflow2(windows_size, sizeof(double))) {
|
||||
return NULL;
|
||||
} else {
|
||||
weights_size = windows_size * sizeof(double);
|
||||
}
|
||||
res = (LineContribType *) gdMalloc(sizeof(LineContribType));
|
||||
if (!res) {
|
||||
return NULL;
|
||||
@@ -898,15 +903,10 @@ static inline LineContribType * _gdContributionsAlloc(unsigned int line_length,
|
||||
return NULL;
|
||||
}
|
||||
for (u = 0 ; u < line_length ; u++) {
|
||||
if (overflow2(windows_size, sizeof(double))) {
|
||||
overflow_error = 1;
|
||||
} else {
|
||||
res->ContribRow[u].Weights = (double *) gdMalloc(windows_size * sizeof(double));
|
||||
}
|
||||
if (overflow_error == 1 || res->ContribRow[u].Weights == NULL) {
|
||||
res->ContribRow[u].Weights = (double *) gdMalloc(weights_size);
|
||||
if (res->ContribRow[u].Weights == NULL) {
|
||||
unsigned int i;
|
||||
u--;
|
||||
for (i=0;i<=u;i++) {
|
||||
for (i=0;i<u;i++) {
|
||||
gdFree(res->ContribRow[i].Weights);
|
||||
}
|
||||
gdFree(res->ContribRow);
|
||||
|
||||
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===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #77269 (Potential unsigned underflow in gdImageScale)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
?>
|
||||
--INI--
|
||||
memory_limit=2G
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreate(2**28, 1);
|
||||
if(is_resource($im)) {
|
||||
imagescale($im, 1, 1, IMG_TRIANGLE);
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreate():%S product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
|
||||
in %s on line %d
|
||||
===DONE===
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #77270 (imagecolormatch Out Of Bounds Write on Heap)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream bugfix has not been released');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$img1 = imagecreatetruecolor(0xfff, 0xfff);
|
||||
$img2 = imagecreate(0xfff, 0xfff);
|
||||
imagecolorallocate($img2, 0, 0, 0);
|
||||
imagesetpixel($img2, 0, 0, 255);
|
||||
imagecolormatch($img1, $img2);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -2672,6 +2672,9 @@ static int php_iconv_stream_filter_append_bucket(
|
||||
tcnt = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "iconv stream filter (\"%s\"=>\"%s\"): invalid multibyte sequence", self->from_charset, self->to_charset);
|
||||
goto out_failure;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #76249 (stream filter convert.iconv leads to infinite loop on invalid sequence)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$fh = fopen('php://memory', 'rw');
|
||||
fwrite($fh, "abc");
|
||||
rewind($fh);
|
||||
if (false === @stream_filter_append($fh, 'convert.iconv.ucs-2/utf8//IGNORE', STREAM_FILTER_READ, [])) {
|
||||
stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []);
|
||||
}
|
||||
$a = stream_get_contents($fh);
|
||||
var_dump(strlen($a));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: stream_get_contents(): iconv stream filter ("ucs-2"=>"utf%A8//IGNORE"): invalid multibyte sequence in %sbug76249.php on line %d
|
||||
int(3)
|
||||
DONE
|
||||
+19
-1
@@ -562,6 +562,15 @@ static const zend_module_dep imap_deps[] = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ PHP_INI
|
||||
*/
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("imap.enable_insecure_rsh", "0", PHP_INI_SYSTEM, OnUpdateBool, enable_rsh, zend_imap_globals, imap_globals)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ imap_module_entry
|
||||
*/
|
||||
zend_module_entry imap_module_entry = {
|
||||
@@ -835,6 +844,8 @@ PHP_MINIT_FUNCTION(imap)
|
||||
{
|
||||
unsigned long sa_all = SA_MESSAGES | SA_RECENT | SA_UNSEEN | SA_UIDNEXT | SA_UIDVALIDITY;
|
||||
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
mail_link(&unixdriver); /* link in the unix driver */
|
||||
mail_link(&mhdriver); /* link in the mh driver */
|
||||
@@ -1052,6 +1063,12 @@ PHP_MINIT_FUNCTION(imap)
|
||||
GC_TEXTS texts
|
||||
*/
|
||||
|
||||
if (!IMAPG(enable_rsh)) {
|
||||
/* disable SSH and RSH, see https://bugs.php.net/bug.php?id=77153 */
|
||||
mail_parameters (NIL, SET_RSHTIMEOUT, 0);
|
||||
mail_parameters (NIL, SET_SSHTIMEOUT, 0);
|
||||
}
|
||||
|
||||
le_imap = zend_register_list_destructors_ex(mail_close_it, NULL, "imap", module_number);
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -1138,6 +1155,8 @@ PHP_MINFO_FUNCTION(imap)
|
||||
php_info_print_table_row(2, "Kerberos Support", "enabled");
|
||||
#endif
|
||||
php_info_print_table_end();
|
||||
|
||||
DISPLAY_INI_ENTRIES();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -4075,7 +4094,6 @@ PHP_FUNCTION(imap_mail)
|
||||
if (!message_len) {
|
||||
/* this is not really an error, so it is allowed. */
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message string in mail command");
|
||||
message = NULL;
|
||||
}
|
||||
|
||||
if (_php_imap_mail(to, subject, message, headers, cc, bcc, rpath TSRMLS_CC)) {
|
||||
|
||||
@@ -214,6 +214,7 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
|
||||
#endif
|
||||
/* php_stream for php_mail_gets() */
|
||||
php_stream *gets_stream;
|
||||
zend_bool enable_rsh;
|
||||
ZEND_END_MODULE_GLOBALS(imap)
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #77020 (null pointer dereference in imap_mail)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('imap')) die('skip imap extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imap_mail('1', 1, NULL);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imap_mail(): No message string in mail command in %s on line %d
|
||||
%s
|
||||
===DONE===
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #77153 (imap_open allows to run arbitrary shell commands via mailbox parameter)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("imap")) {
|
||||
die("skip imap extension not available");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$payload = "echo 'BUG'> " . __DIR__ . '/__bug';
|
||||
$payloadb64 = base64_encode($payload);
|
||||
$server = "x -oProxyCommand=echo\t$payloadb64|base64\t-d|sh}";
|
||||
@imap_open('{'.$server.':143/imap}INBOX', '', '');
|
||||
// clean
|
||||
imap_errors();
|
||||
var_dump(file_exists(__DIR__ . '/__bug'));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
--CLEAN--
|
||||
<?php
|
||||
if(file_exists(__DIR__ . '/__bug')) unlink(__DIR__ . '/__bug');
|
||||
?>
|
||||
+5
-1
@@ -1103,7 +1103,11 @@ PHP_FUNCTION(ldap_get_entries)
|
||||
|
||||
add_assoc_long(tmp1, "count", num_attrib);
|
||||
dn = ldap_get_dn(ldap, ldap_result_entry);
|
||||
add_assoc_string(tmp1, "dn", dn, 1);
|
||||
if (dn) {
|
||||
add_assoc_string(tmp1, "dn", dn, 1);
|
||||
} else {
|
||||
add_assoc_null(tmp1, "dn");
|
||||
}
|
||||
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS
|
||||
ldap_memfree(dn);
|
||||
#else
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #76248 (Malicious LDAP-Server Response causes Crash)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
if (!function_exists('pcntl_fork')) die('skip fork not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$pid = pcntl_fork();
|
||||
const PORT = 12345;
|
||||
if ($pid == 0) {
|
||||
// child
|
||||
$server = stream_socket_server("tcp://127.0.0.1:12345");
|
||||
$socket = stream_socket_accept($server, 3);
|
||||
fwrite($socket, base64_decode("MAwCAQFhBwoBAAQABAAweQIBAmR0BJljbj1yb290LGRjPWV4YW1wbGUsZGM9Y29tMFcwIwQLb2JqZWN0Q2xhc3MxFAQSb3JnYW5pemF0aW9uYWxSb2xlMAwEAmNuMQYEBHJvb3QwIgQLZGVzY3JpcHRpb24xEwQRRGlyZWN0b3J5IE1hbmFnZXIwDAIBAmUHCgEABAAEADB5AgEDZHQEmWNuPXJvb3QsZGM9ZXhhbXBsZSxkYz1jb20wVzAjBAtvYmplY3RDbGFzczEUBBJvcmdhbml6YXRpb25hbFJvbGUwDAQCY24xBgQEcm9vdDAiBAtkZXNjcmlwdGlvbjETBBFEaXJlY3RvcnkgTWFuYWdlcjAMAgEDZQcKAQAEAAQA"));
|
||||
fflush($socket);
|
||||
} else {
|
||||
// parent
|
||||
$ds = ldap_connect("127.0.0.1", PORT);
|
||||
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
$b = ldap_bind($ds, "cn=root,dc=example,dc=com", "secret");
|
||||
|
||||
$s = ldap_search($ds, "dc=example,dc=com", "(cn=root)");
|
||||
$tt = ldap_get_entries($ds, $s);
|
||||
var_dump($tt);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(1)
|
||||
[0]=>
|
||||
array(2) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
["dn"]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
@@ -10971,6 +10971,7 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc,
|
||||
|
||||
code = ONIGENC_MBC_TO_CODE(enc, p, end);
|
||||
len = enclen(enc, p);
|
||||
if (*pp + len > end) len = end - *pp;
|
||||
*pp += len;
|
||||
|
||||
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
|
||||
|
||||
@@ -75,16 +75,18 @@ utf16be_is_mbc_newline(const UChar* p, const UChar* end)
|
||||
}
|
||||
|
||||
static OnigCodePoint
|
||||
utf16be_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
|
||||
utf16be_mbc_to_code(const UChar* p, const UChar* end)
|
||||
{
|
||||
OnigCodePoint code;
|
||||
|
||||
if (UTF16_IS_SURROGATE_FIRST(*p)) {
|
||||
if (end - p < 4) return 0;
|
||||
code = ((((p[0] - 0xd8) << 2) + ((p[1] & 0xc0) >> 6) + 1) << 16)
|
||||
+ ((((p[1] & 0x3f) << 2) + (p[2] - 0xdc)) << 8)
|
||||
+ p[3];
|
||||
}
|
||||
else {
|
||||
if (end - p < 2) return 0;
|
||||
code = p[0] * 256 + p[1];
|
||||
}
|
||||
return code;
|
||||
|
||||
@@ -81,13 +81,14 @@ utf16le_is_mbc_newline(const UChar* p, const UChar* end)
|
||||
}
|
||||
|
||||
static OnigCodePoint
|
||||
utf16le_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
|
||||
utf16le_mbc_to_code(const UChar* p, const UChar* end)
|
||||
{
|
||||
OnigCodePoint code;
|
||||
UChar c0 = *p;
|
||||
UChar c1 = *(p+1);
|
||||
|
||||
if (UTF16_IS_SURROGATE_FIRST(c1)) {
|
||||
if (end - p < 4) return 0;
|
||||
code = ((((c1 - 0xd8) << 2) + ((c0 & 0xc0) >> 6) + 1) << 16)
|
||||
+ ((((c0 & 0x3f) << 2) + (p[3] - 0xdc)) << 8)
|
||||
+ p[2];
|
||||
|
||||
@@ -60,6 +60,7 @@ utf32be_is_mbc_newline(const UChar* p, const UChar* end)
|
||||
static OnigCodePoint
|
||||
utf32be_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
|
||||
{
|
||||
if (end - p < 4) return 0;
|
||||
return (OnigCodePoint )(((p[0] * 256 + p[1]) * 256 + p[2]) * 256 + p[3]);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ utf32le_is_mbc_newline(const UChar* p, const UChar* end)
|
||||
static OnigCodePoint
|
||||
utf32le_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
|
||||
{
|
||||
if (end - p < 4) return 0;
|
||||
return (OnigCodePoint )(((p[3] * 256 + p[2]) * 256 + p[1]) * 256 + p[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -469,13 +469,13 @@ compile_length_string_node(Node* node, regex_t* reg)
|
||||
ambig = NSTRING_IS_AMBIG(node);
|
||||
|
||||
p = prev = sn->s;
|
||||
prev_len = enclen(enc, p);
|
||||
SAFE_ENC_LEN(enc, p, sn->end, prev_len);
|
||||
p += prev_len;
|
||||
slen = 1;
|
||||
rlen = 0;
|
||||
|
||||
for (; p < sn->end; ) {
|
||||
len = enclen(enc, p);
|
||||
SAFE_ENC_LEN(enc, p, sn->end, len);
|
||||
if (len == prev_len) {
|
||||
slen++;
|
||||
}
|
||||
@@ -518,12 +518,12 @@ compile_string_node(Node* node, regex_t* reg)
|
||||
ambig = NSTRING_IS_AMBIG(node);
|
||||
|
||||
p = prev = sn->s;
|
||||
prev_len = enclen(enc, p);
|
||||
SAFE_ENC_LEN(enc, p, end, prev_len);
|
||||
p += prev_len;
|
||||
slen = 1;
|
||||
|
||||
for (; p < end; ) {
|
||||
len = enclen(enc, p);
|
||||
SAFE_ENC_LEN(enc, p, end, len);
|
||||
if (len == prev_len) {
|
||||
slen++;
|
||||
}
|
||||
@@ -3390,7 +3390,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
|
||||
goto err;
|
||||
}
|
||||
|
||||
len = enclen(reg->enc, p);
|
||||
SAFE_ENC_LEN(reg->enc, p, end, len);
|
||||
|
||||
if (n == 0) {
|
||||
if (IS_NULL(snode)) {
|
||||
|
||||
@@ -260,14 +260,17 @@ strdup_with_null(OnigEncoding enc, UChar* s, UChar* end)
|
||||
c = ONIGENC_MBC_TO_CODE(enc, p, end); \
|
||||
pfetch_prev = p; \
|
||||
p += ONIGENC_MBC_ENC_LEN(enc, p); \
|
||||
if(UNEXPECTED(p > end)) p = end; \
|
||||
} while (0)
|
||||
|
||||
#define PINC_S do { \
|
||||
p += ONIGENC_MBC_ENC_LEN(enc, p); \
|
||||
if(UNEXPECTED(p > end)) p = end; \
|
||||
} while (0)
|
||||
#define PFETCH_S(c) do { \
|
||||
c = ONIGENC_MBC_TO_CODE(enc, p, end); \
|
||||
p += ONIGENC_MBC_ENC_LEN(enc, p); \
|
||||
if(UNEXPECTED(p > end)) p = end; \
|
||||
} while (0)
|
||||
|
||||
#define PPEEK (p < end ? ONIGENC_MBC_TO_CODE(enc, p, end) : PEND_VALUE)
|
||||
@@ -3580,7 +3583,9 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
|
||||
tok->u.code = (OnigCodePoint )num;
|
||||
}
|
||||
else { /* string */
|
||||
p = tok->backp + enclen(enc, tok->backp);
|
||||
int len;
|
||||
SAFE_ENC_LEN(enc, tok->backp, end, len);
|
||||
p = tok->backp + len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -348,4 +348,16 @@ extern int onig_print_names(FILE*, regex_t*);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined (__GNUC__) && __GNUC__ > 2 ) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
|
||||
# define UNEXPECTED(condition) __builtin_expect(condition, 0)
|
||||
#else
|
||||
# define UNEXPECTED(condition) (condition)
|
||||
#endif
|
||||
|
||||
#define SAFE_ENC_LEN(enc, p, end, res) do { \
|
||||
int __res = enclen(enc, p); \
|
||||
if (UNEXPECTED(p + __res > end)) __res = end - p; \
|
||||
res = __res; \
|
||||
} while(0);
|
||||
|
||||
#endif /* REGPARSE_H */
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #77370 (Buffer overflow on mb regex functions - fetch_token)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mb_split(" \xfd",""));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mb_ereg("()0\xfc00000\xfc00000\xfc00000\xfc",""));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #77381 (heap buffer overflow in multibyte match_at)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mb_ereg("000||0\xfa","0"));
|
||||
var_dump(mb_ereg("(?i)000000000000000000000\xf0",""));
|
||||
var_dump(mb_ereg("0000\\"."\xf5","0"));
|
||||
var_dump(mb_ereg("(?i)FFF00000000000000000\xfd",""));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #77371 (Heap overflow in utf32be_mbc_to_code)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
mb_regex_encoding("UTF-32");
|
||||
var_dump(mb_split("\x00\x00\x00\x5c\x00\x00\x00B","000000000000000000000000000000"));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(30) "000000000000000000000000000000"
|
||||
}
|
||||
@@ -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==
|
||||
@@ -1,42 +1,35 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIHZzCCBU+gAwIBAgIBATANBgkqhkiG9w0BAQQFADCByzEpMCcGA1UEAxMgQ2F0
|
||||
YXBocmFjdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxCzAJBgNVBAYTAlBUMQ8wDQYD
|
||||
VQQHEwZMaXNib2ExETAPBgNVBAgTCFBvcnR1Z2FsMSkwJwYDVQQKEyBDYXRhcGhy
|
||||
YWN0IENlcnRpZmljYXRlIEF1dGhvcml0eTEcMBoGA1UECxMTQ2VydGlmaWNhdGUg
|
||||
U2lnbmluZzEkMCIGCSqGSIb3DQEJARYVQ2F0YXBocmFjdEBuZXRjYWJvLnB0MB4X
|
||||
DTAzMTIwNTAwMTExOVoXDTE4MTIwMTAwMTExOVowgcsxKTAnBgNVBAMTIENhdGFw
|
||||
aHJhY3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQswCQYDVQQGEwJQVDEPMA0GA1UE
|
||||
BxMGTGlzYm9hMREwDwYDVQQIEwhQb3J0dWdhbDEpMCcGA1UEChMgQ2F0YXBocmFj
|
||||
dCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHDAaBgNVBAsTE0NlcnRpZmljYXRlIFNp
|
||||
Z25pbmcxJDAiBgkqhkiG9w0BCQEWFUNhdGFwaHJhY3RAbmV0Y2Fiby5wdDCCAiIw
|
||||
DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANg+noZuxtWdxmZjxanJGEpzmDYu
|
||||
Uko9OHdmhVr3UU+z04a9JFT7aH5wuwrnpadNy1u9CqrSHVWFEtSmOMOH8QYzIy4C
|
||||
qCjFPSJR5UQjxpxTZeXaTvfhKI9n0LMSqc7I68HkP5MF64N3Z2cRdYvM4U6R5ERD
|
||||
Xw2LiR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
vXkFp+aEP35BAgMBAAGjUzBRMB0GA1UdDgQWBBR37F1+W1gcCp8bhZaFFi9JKQhu
|
||||
tTAfBgNVHSMEGDAWgBR37F1+W1gcCp8bhZaFFi9JKQhutTAPBgNVHRMBAf8EBTAD
|
||||
AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQAYHqpISUI/x8UW33i35rYkFYNvXBMQDc8J
|
||||
v4G2eqEBNCOVmHg6P//lq1F2jrtAEr/saESN1uS1Q80sUsthlVsceV1z1isdpugG
|
||||
kMbfHxLe0QpthnP3PEChQw30TPB22BThuGVkteNSZKTCPGdzjSTPq2kOR6PCBZRd
|
||||
r0r/TW3lT/Ng3KgjT6g7E3ZUpAeFEQMlmNYr/eEOL7K+1jzQrbCLmXbs6rmtffr7
|
||||
n4p+wMPMPaSRqQoQ86ff9GPzxWuAQGlytVoiS5Xt3jotd/RWlOy0YQ2QSzOQvFUW
|
||||
4te5lwdOvOFnJTo43U3DqASqMcaazvIsN41zVlOyOyKEr9oZERju6FU1aZmuZtHQ
|
||||
wMCmXVj/Swj67Zp9tG+vVQenbEk314+8c2nenuOIFP1F2C/NG3vMLIpENRGxpmAm
|
||||
s5gIT6mXvJ4JCwWYc75zucOr2KVkDmEziJh/pARuOrOAPdc6NjKku8HBC9UI96+x
|
||||
Db4hG2SqXUzShkFX/px7vlCADvgO3FDk2aiyW02PFsItob2O6OB98VGsU26hgRO/
|
||||
Czz/jbjWTPHNOt6/fcL0m7XLwlJ+K9gRArY15DeJGumcHEq/Vd/Z8iPQKKdzgF4O
|
||||
9XFZvu+VHP82AS5TeiYHCddFJyzktQYcNu5/OBuxzO83d7rpqrLFETTEOL4cN8O7
|
||||
LJ7Q89hYAQ==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,34 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFizCCA3OgAwIBAgIBGTANBgkqhkiG9w0BAQUFADCByzEpMCcGA1UEAxMgQ2F0
|
||||
YXBocmFjdCBDZ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Axo2m9u0
|
||||
pUZLAulZ1lS7g/sr7/8Pp17RDvJiJh+oAPyVYZ7OoLF1IoHDHcZI0bqcqhDhiHZs
|
||||
PXYqyMCxyYzHFOAOgvbrEkmp8z/E8ATVwdUbAYN1dMrYHre1P4HFEtJh2QiGG2KE
|
||||
4jheuNhH1R25AizbwYbD33Kdp7ltCgBlfYqjl771SlgY45QYs0mUdc1Pv39SGIwf
|
||||
ZUm7mOWjaTBdYANrkvGM5NNT9kESjKkWykyTg4UF5rHV6nlyexR4b3fjabroi4BS
|
||||
v6w=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXgIBAAKBgQC1QBVApOClQ+C0U4nfDeQMkRNLjm1Z5P3qRSDU15gspb6M1sWH
|
||||
|
||||
@@ -6,6 +6,48 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
|
||||
if (!function_exists("proc_open")) die("skip no proc_open");
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
How to generate bug54992.pem and bug54992-ca.pem and all dependants:
|
||||
|
||||
All the commands below assume you're in the root of php sources
|
||||
|
||||
Generate new key for CA:
|
||||
$ openssl genrsa -out ./ext/openssl/tests/bug54992-ca.key 4096
|
||||
|
||||
Create new CA:
|
||||
$ openssl req -new -x509 -key ./ext/openssl/tests/bug54992-ca.key \
|
||||
-out ext/openssl/tests/bug54992-ca.pem \
|
||||
-subj '/C=PT/ST=Lisboa/L=Lisboa/O=PHP Foundation/CN=Root CA for PHP Tests/emailAddress=internals@lists.php.net' \
|
||||
-days 400
|
||||
|
||||
Extract private key from the bundle:
|
||||
$ openssl rsa -in ext/openssl/tests/bug54992.pem > ext/openssl/tests/bug54992.key
|
||||
|
||||
Extract CSR from existing certificate:
|
||||
$ openssl x509 -x509toreq -in ext/openssl/tests/bug54992.pem -out ext/openssl/tests/bug54992.csr -signkey ext/openssl/tests/bug54992.key
|
||||
|
||||
Sign the CSR:
|
||||
$ openssl x509 -CA ext/openssl/tests/bug54992-ca.pem \
|
||||
-CAcreateserial \
|
||||
-CAkey ./ext/openssl/tests/bug54992-ca.key \
|
||||
-req \
|
||||
-in ext/openssl/tests/bug54992.csr \
|
||||
-sha256 \
|
||||
-days 400 \
|
||||
-out ./ext/openssl/tests/bug54992.pem
|
||||
|
||||
Bundle certificate's private key with the certificate:
|
||||
$ cat ext/openssl/tests/bug54992.key >> ext/openssl/tests/bug54992.pem\
|
||||
|
||||
|
||||
Dependants:
|
||||
|
||||
1. ext/openssl/tests/bug65538_003.phpt
|
||||
Run the following to generate required phar:
|
||||
php -d phar.readonly=Off -r '$phar = new Phar("ext/openssl/tests/bug65538.phar"); $phar->addFile("ext/openssl/tests/bug54992.pem", "bug54992.pem"); $phar->addFile("ext/openssl/tests/bug54992-ca.pem", "bug54992-ca.pem");'
|
||||
|
||||
2. Update ext/openssl/tests/openssl_peer_fingerprint_basic.phpt (see instructions in there)
|
||||
*/
|
||||
$serverCode = <<<'CODE'
|
||||
$serverUri = "ssl://127.0.0.1:64321";
|
||||
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|
||||
|
||||
Binary file not shown.
@@ -32,12 +32,17 @@ $clientCode = <<<'CODE'
|
||||
|
||||
phpt_wait();
|
||||
|
||||
// should be: 81cafc260aa8d82956ebc6212a362ecc
|
||||
stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', '81cafc260aa8d82956ebc6212a362ece');
|
||||
// Run the following to get actual md5 (from sources root):
|
||||
// openssl x509 -noout -fingerprint -md5 -inform pem -in ext/openssl/tests/bug54992.pem | cut -d '=' -f 2 | tr -d ':' | tr 'A-F' 'a-f'
|
||||
// Currently it's 4edbbaf40a6a4b6af22b6d6d9818378f
|
||||
// One below is intentionally broken (compare the last character):
|
||||
stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', '4edbbaf40a6a4b6af22b6d6d98183780');
|
||||
var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx));
|
||||
|
||||
// Run the following to get actual sha256 (from sources root):
|
||||
// openssl x509 -noout -fingerprint -sha256 -inform pem -in ext/openssl/tests/bug54992.pem | cut -d '=' -f 2 | tr -d ':' | tr 'A-F' 'a-f'
|
||||
stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', [
|
||||
'sha256' => '78ea579f2c3b439359dec5dac9d445108772927427c4780037e87df3799a0aa0',
|
||||
'sha256' => 'b1d480a2f83594fa243d26378cf611f334d369e59558d87e3de1abe8f36cb997',
|
||||
]);
|
||||
var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx));
|
||||
CODE;
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -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==
|
||||
+22
-10
@@ -638,6 +638,18 @@ int phar_parse_metadata(char **buffer, zval **metadata, php_uint32 zip_metadata_
|
||||
}
|
||||
/* }}}*/
|
||||
|
||||
/**
|
||||
* Size of fixed fields in the manifest.
|
||||
* See: http://php.net/manual/en/phar.fileformat.phar.php
|
||||
*/
|
||||
#define MANIFEST_FIXED_LEN 18
|
||||
|
||||
#define SAFE_PHAR_GET_32(buffer, endbuffer, var) \
|
||||
if (UNEXPECTED(buffer + 4 > endbuffer)) { \
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest header)"); \
|
||||
} \
|
||||
PHAR_GET_32(buffer, var);
|
||||
|
||||
/**
|
||||
* Does not check for a previously opened phar in the cache.
|
||||
*
|
||||
@@ -721,12 +733,12 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
savebuf = buffer;
|
||||
endbuffer = buffer + manifest_len;
|
||||
|
||||
if (manifest_len < 10 || manifest_len != php_stream_read(fp, buffer, manifest_len)) {
|
||||
if (manifest_len < MANIFEST_FIXED_LEN || manifest_len != php_stream_read(fp, buffer, manifest_len)) {
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest header)")
|
||||
}
|
||||
|
||||
/* extract the number of entries */
|
||||
PHAR_GET_32(buffer, manifest_count);
|
||||
SAFE_PHAR_GET_32(buffer, endbuffer, manifest_count);
|
||||
|
||||
if (manifest_count == 0) {
|
||||
MAPPHAR_FAIL("in phar \"%s\", manifest claims to have zero entries. Phars must have at least 1 entry");
|
||||
@@ -746,7 +758,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
PHAR_GET_32(buffer, manifest_flags);
|
||||
SAFE_PHAR_GET_32(buffer, endbuffer, manifest_flags);
|
||||
|
||||
manifest_flags &= ~PHAR_HDR_COMPRESSION_MASK;
|
||||
manifest_flags &= ~PHAR_FILE_COMPRESSION_MASK;
|
||||
@@ -966,13 +978,13 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
}
|
||||
|
||||
/* extract alias */
|
||||
PHAR_GET_32(buffer, tmp_len);
|
||||
SAFE_PHAR_GET_32(buffer, endbuffer, tmp_len);
|
||||
|
||||
if (buffer + tmp_len > endbuffer) {
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (buffer overrun)");
|
||||
}
|
||||
|
||||
if (manifest_len < 10 + tmp_len) {
|
||||
if (manifest_len < MANIFEST_FIXED_LEN + tmp_len) {
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest header)")
|
||||
}
|
||||
|
||||
@@ -1010,7 +1022,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
}
|
||||
|
||||
/* we have 5 32-bit items plus 1 byte at least */
|
||||
if (manifest_count > ((manifest_len - 10 - tmp_len) / (5 * 4 + 1))) {
|
||||
if (manifest_count > ((manifest_len - MANIFEST_FIXED_LEN - tmp_len) / (5 * 4 + 1))) {
|
||||
/* prevent serious memory issues */
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (too many manifest entries for size of manifest)")
|
||||
}
|
||||
@@ -1019,12 +1031,12 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
mydata->is_persistent = PHAR_G(persist);
|
||||
|
||||
/* check whether we have meta data, zero check works regardless of byte order */
|
||||
PHAR_GET_32(buffer, len);
|
||||
SAFE_PHAR_GET_32(buffer, endbuffer, len);
|
||||
if (mydata->is_persistent) {
|
||||
mydata->metadata_len = len;
|
||||
if(!len) {
|
||||
if (!len) {
|
||||
/* FIXME: not sure why this is needed but removing it breaks tests */
|
||||
PHAR_GET_32(buffer, len);
|
||||
SAFE_PHAR_GET_32(buffer, endbuffer, len);
|
||||
}
|
||||
}
|
||||
if(len > endbuffer - buffer) {
|
||||
@@ -2005,7 +2017,7 @@ next_extension:
|
||||
}
|
||||
|
||||
while (pos != filename && (*(pos - 1) == '/' || *(pos - 1) == '\0')) {
|
||||
pos = memchr(pos + 1, '.', filename_len - (pos - filename) + 1);
|
||||
pos = memchr(pos + 1, '.', filename_len - (pos - filename) - 1);
|
||||
if (!pos) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
+15
-6
@@ -340,8 +340,7 @@ static void phar_do_403(char *entry, int entry_len TSRMLS_DC) /* {{{ */
|
||||
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
|
||||
sapi_send_headers(TSRMLS_C);
|
||||
PHPWRITE("<html>\n <head>\n <title>Access Denied</title>\n </head>\n <body>\n <h1>403 - File ", sizeof("<html>\n <head>\n <title>Access Denied</title>\n </head>\n <body>\n <h1>403 - File ") - 1);
|
||||
PHPWRITE(entry, entry_len);
|
||||
PHPWRITE(" Access Denied</h1>\n </body>\n</html>", sizeof(" Access Denied</h1>\n </body>\n</html>") - 1);
|
||||
PHPWRITE("Access Denied</h1>\n </body>\n</html>", sizeof("Access Denied</h1>\n </body>\n</html>") - 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -365,8 +364,7 @@ static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, cha
|
||||
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
|
||||
sapi_send_headers(TSRMLS_C);
|
||||
PHPWRITE("<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ", sizeof("<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ") - 1);
|
||||
PHPWRITE(entry, entry_len);
|
||||
PHPWRITE(" Not Found</h1>\n </body>\n</html>", sizeof(" Not Found</h1>\n </body>\n</html>") - 1);
|
||||
PHPWRITE("Not Found</h1>\n </body>\n</html>", sizeof("Not Found</h1>\n </body>\n</html>") - 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -3629,7 +3627,8 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam
|
||||
char *error;
|
||||
size_t contents_len;
|
||||
phar_entry_data *data;
|
||||
php_stream *contents_file;
|
||||
php_stream *contents_file = NULL;
|
||||
php_stream_statbuf ssb;
|
||||
|
||||
if (filename_len >= sizeof(".phar")-1 && !memcmp(filename, ".phar", sizeof(".phar")-1) && (filename[5] == '/' || filename[5] == '\\' || filename[5] == '\0')) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot create any files in magic \".phar\" directory", (*pphar)->fname);
|
||||
@@ -3663,10 +3662,20 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam
|
||||
}
|
||||
php_stream_copy_to_stream_ex(contents_file, data->fp, PHP_STREAM_COPY_ALL, &contents_len);
|
||||
}
|
||||
|
||||
data->internal_file->compressed_filesize = data->internal_file->uncompressed_filesize = contents_len;
|
||||
}
|
||||
|
||||
if (contents_file != NULL && php_stream_stat(contents_file, &ssb) != -1) {
|
||||
data->internal_file->flags = ssb.sb.st_mode & PHAR_ENT_PERM_MASK ;
|
||||
} else {
|
||||
#ifndef _WIN32
|
||||
mode_t mask;
|
||||
mask = umask(0);
|
||||
umask(mask);
|
||||
data->internal_file->flags &= ~mask;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check for copy-on-write */
|
||||
if (pphar[0] != data->phar) {
|
||||
*pphar = data->phar;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -13,4 +13,4 @@ echo "OK\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
cannot load phar "%sbug73768.phar" with implicit alias "" under different alias "alias.phar"
|
||||
internal corruption of phar "%sbug73768.phar" (truncated manifest header)
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Phar: Bug #77022: PharData always creates new files with mode 0666
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("phar")) die("skip");
|
||||
if (defined("PHP_WINDOWS_VERSION_MAJOR")) die("skip not for Windows")
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
umask(022);
|
||||
var_dump(decoct(umask()));
|
||||
|
||||
$sFile = tempnam(__DIR__, 'test77022');
|
||||
var_dump(decoct(stat($sFile)['mode']));
|
||||
|
||||
foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) {
|
||||
clearstatcache();
|
||||
$phar = new PharData(__DIR__ . '/test77022.' . $ext, null, null, $mode);
|
||||
$phar->addFile($sFile, 'test-file-phar');
|
||||
$phar->addFromString("test-from-string", 'test-file-phar');
|
||||
$phar->extractTo(__DIR__);
|
||||
var_dump(decoct(stat(__DIR__ . '/test-file-phar')['mode']));
|
||||
var_dump(decoct(stat(__DIR__ . '/test-from-string')['mode']));
|
||||
unlink(__DIR__ . '/test-file-phar');
|
||||
unlink(__DIR__ . '/test-from-string');
|
||||
unlink(__DIR__ . '/test77022.' . $ext);
|
||||
}
|
||||
unlink($sFile);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "22"
|
||||
string(6) "100600"
|
||||
string(6) "100600"
|
||||
string(6) "100644"
|
||||
string(6) "100600"
|
||||
string(6) "100644"
|
||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
PHP bug #77143: Heap Buffer Overflow (READ: 4) in phar_parse_pharfile
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
chdir(__DIR__);
|
||||
try {
|
||||
var_dump(new Phar('bug77143.phar',0,'project.phar'));
|
||||
echo "OK\n";
|
||||
} catch(UnexpectedValueException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
internal corruption of phar "%sbug77143.phar" (truncated manifest header)
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
PHP bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
var_dump(new Phar('a/.b', 0,'test.phar'));
|
||||
} catch(UnexpectedValueException $e) {
|
||||
echo "OK";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -18,5 +18,5 @@ echo strlen($p2->getStub()),"\n";
|
||||
echo "ok\n";
|
||||
__HALT_COMPILER(); ?>
|
||||
"
|
||||
6685
|
||||
6675
|
||||
ok
|
||||
@@ -20,6 +20,6 @@ Status: 403 Access Denied
|
||||
<title>Access Denied</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>403 - File /hi Access Denied</h1>
|
||||
<h1>403 - File Access Denied</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -18,6 +18,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /notfound.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -18,6 +18,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /index.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -19,6 +19,6 @@ Status: 403 Access Denied
|
||||
<title>Access Denied</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>403 - File /hi Access Denied</h1>
|
||||
<h1>403 - File Access Denied</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,6 +16,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /notfound.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,6 +16,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /index.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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===
|
||||
@@ -7,6 +7,7 @@ phar.require_hash=1
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
umask(0);
|
||||
Phar::interceptFileFuncs();
|
||||
var_dump(stat(""));
|
||||
|
||||
|
||||
@@ -19,6 +19,6 @@ Status: 403 Access Denied
|
||||
<title>Access Denied</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>403 - File /hi Access Denied</h1>
|
||||
<h1>403 - File Access Denied</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,6 +16,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /notfound.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,6 +16,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /index.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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===
|
||||
@@ -19,6 +19,6 @@ Status: 403 Access Denied
|
||||
<title>Access Denied</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>403 - File /hi Access Denied</h1>
|
||||
<h1>403 - File Access Denied</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,6 +17,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /notfound.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,6 +16,6 @@ Status: 404 Not Found
|
||||
<title>File Not Found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404 - File /index.php Not Found</h1>
|
||||
<h1>404 - File Not Found</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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===
|
||||
@@ -928,7 +928,7 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
|
||||
line_ccnt--;
|
||||
CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
|
||||
} else {
|
||||
if (line_ccnt < 4) {
|
||||
if (line_ccnt < 4 && inst->lbchars != NULL) {
|
||||
if (ocnt < inst->lbchars_len + 1) {
|
||||
err = PHP_CONV_ERR_TOO_BIG;
|
||||
break;
|
||||
|
||||
@@ -737,9 +737,9 @@ finish:
|
||||
tmp_line, response_code);
|
||||
}
|
||||
}
|
||||
if (tmp_line[tmp_line_len - 1] == '\n') {
|
||||
if (tmp_line_len >= 1 && tmp_line[tmp_line_len - 1] == '\n') {
|
||||
--tmp_line_len;
|
||||
if (tmp_line[tmp_line_len - 1] == '\r') {
|
||||
if (tmp_line_len >= 1 &&tmp_line[tmp_line_len - 1] == '\r') {
|
||||
--tmp_line_len;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,8 @@ PHP_FUNCTION(readlink)
|
||||
PHP_FUNCTION(linkinfo)
|
||||
{
|
||||
char *link;
|
||||
int link_len;
|
||||
char *dirname;
|
||||
int link_len, dir_len;
|
||||
struct stat sb;
|
||||
int ret;
|
||||
|
||||
@@ -95,12 +96,22 @@ PHP_FUNCTION(linkinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
dirname = estrndup(link, link_len);
|
||||
dir_len = php_dirname(dirname, link_len);
|
||||
|
||||
if (php_check_open_basedir(dirname TSRMLS_CC)) {
|
||||
efree(dirname);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret = VCWD_STAT(link, &sb);
|
||||
if (ret == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
|
||||
efree(dirname);
|
||||
RETURN_LONG(-1L);
|
||||
}
|
||||
|
||||
efree(dirname);
|
||||
RETURN_LONG((long) sb.st_dev);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #77231 (Segfault when using convert.quoted-printable-encode filter)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(file(urldecode('php://filter/convert.quoted-printable-encode/resource=data://,%bfAAAAAAAAFAAAAAAAAAAAAAA%ff%ff%ff%ff%ff%ff%ff%ffAAAAAAAAAAAAAAAAAAAAAAAA')));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(74) "=BFAAAAAAAAFAAAAAAAAAAAAAA=FF=FF=FF=FF=FF=FF=FF=FFAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
Bug #75981 (stack-buffer-overflow while parsing HTTP response)
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
--SKIPIF--
|
||||
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$options = [
|
||||
'http' => [
|
||||
'protocol_version' => '1.1',
|
||||
'header' => 'Connection: Close'
|
||||
],
|
||||
];
|
||||
|
||||
$ctx = stream_context_create($options);
|
||||
|
||||
$responses = [
|
||||
"data://text/plain,000000000100\xA\xA"
|
||||
];
|
||||
$pid = http_server('tcp://127.0.0.1:12342', $responses);
|
||||
|
||||
echo @file_get_contents('http://127.0.0.1:12342/', false, $ctx);
|
||||
|
||||
http_server_kill($pid);
|
||||
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75055 Out-Of-Bounds Read in timelib_meridian()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("wddx")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$file_str = dirname(__FILE__) . "/bug75055.wddx";
|
||||
|
||||
$wddx_str = file_get_contents($file_str);
|
||||
print strlen($wddx_str) . " bytes read.\n";
|
||||
|
||||
var_dump(wddx_deserialize($wddx_str));
|
||||
?>
|
||||
--EXPECT--
|
||||
323 bytes read.
|
||||
array(1) {
|
||||
["aDateTime"]=>
|
||||
string(12) "frONt of 0 0"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'>
|
||||
<wddxPacket version='1.0'>
|
||||
<header/>
|
||||
<data>
|
||||
<struct>
|
||||
<var name='aDateTime'>
|
||||
<dateTime>frONt of 0 0</dateTime>
|
||||
</var>
|
||||
</struct>
|
||||
</data>
|
||||
</wddxPacket>
|
||||
|
||||
@@ -77,7 +77,7 @@ void base64_encode_xmlrpc(struct buffer_st *b, const char *source, int length)
|
||||
|
||||
while (!hiteof) {
|
||||
unsigned char igroup[3], ogroup[4];
|
||||
int c, n;
|
||||
int c, n;
|
||||
|
||||
igroup[0] = igroup[1] = igroup[2] = 0;
|
||||
for (n = 0; n < 3; n++) {
|
||||
@@ -169,7 +169,7 @@ void base64_decode_xmlrpc(struct buffer_st *bfr, const char *source, int length)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dtable[c] & 0x80) {
|
||||
if (dtable[(unsigned char)c] & 0x80) {
|
||||
/*
|
||||
fprintf(stderr, "Offset %i length %i\n", offset, length);
|
||||
fprintf(stderr, "character '%c:%x:%c' in input file.\n", c, c, dtable[c]);
|
||||
|
||||
@@ -723,6 +723,9 @@ xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTI
|
||||
long byte_idx = XML_GetCurrentByteIndex(parser);
|
||||
/* int byte_total = XML_GetCurrentByteCount(parser); */
|
||||
const char * error_str = XML_ErrorString(err_code);
|
||||
if(byte_idx > len) {
|
||||
byte_idx = len;
|
||||
}
|
||||
if(byte_idx >= 0) {
|
||||
snprintf(buf,
|
||||
sizeof(buf),
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #77242 (heap out of bounds read in xmlrpc_decode())
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(xmlrpc_decode(base64_decode("PD94bWwgdmVyc2lvbmVuY29kaW5nPSJJU084ODU5NyKkpKSkpKSkpKSkpKSkpKSkpKSkpKSk")));
|
||||
?>
|
||||
--EXPECT--
|
||||
NULL
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #77380 (Global out of bounds read in xmlrpc base64 code)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("xmlrpc")) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(xmlrpc_decode(base64_decode("PGJhc2U2ND7CkzwvYmFzZTY0Pgo=")));
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (2) {
|
||||
["scalar"]=>
|
||||
string(0) ""
|
||||
["xmlrpc_type"]=>
|
||||
string(6) "base64"
|
||||
}
|
||||
@@ -726,7 +726,12 @@ _zip_read_eocd64(FILE *f, const zip_uint8_t *eocd64loc, const zip_uint8_t *buf,
|
||||
_zip_error_set(error, ZIP_ER_SEEK, EFBIG);
|
||||
return NULL;
|
||||
}
|
||||
if ((flags & ZIP_CHECKCONS) && offset+size != eocd_offset) {
|
||||
if (offset+size > buf_offset + eocd_offset) {
|
||||
/* cdir spans past EOCD record */
|
||||
_zip_error_set(error, ZIP_ER_INCONS, 0);
|
||||
return NULL;
|
||||
}
|
||||
if ((flags & ZIP_CHECKCONS) && offset+size != buf_offset + eocd_offset) {
|
||||
_zip_error_set(error, ZIP_ER_INCONS, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 6
|
||||
#define PHP_RELEASE_VERSION 32
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "5.6.32-dev"
|
||||
#define PHP_VERSION_ID 50632
|
||||
#define PHP_RELEASE_VERSION 40
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.6.40"
|
||||
#define PHP_VERSION_ID 50640
|
||||
@@ -678,6 +678,7 @@ zend_first_try {
|
||||
if (!parent_req) {
|
||||
php_apache_request_dtor(r TSRMLS_CC);
|
||||
ctx->request_processed = 1;
|
||||
apr_brigade_cleanup(brigade);
|
||||
bucket = apr_bucket_eos_create(r->connection->bucket_alloc);
|
||||
APR_BRIGADE_INSERT_TAIL(brigade, bucket);
|
||||
|
||||
|
||||
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user