Skip to content

Commit eb0871e

Browse files
committed
Merge remote-tracking branch 'php/master'
2 parents a212d4c + ce55152 commit eb0871e

38 files changed

+2160
-71
lines changed

.cirrus.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/actions/freebsd/action.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: FreeBSD
2+
runs:
3+
using: composite
4+
steps:
5+
- name: FreeBSD
6+
uses: vmactions/freebsd-vm@v1
7+
with:
8+
release: '13.3'
9+
usesh: true
10+
# Temporarily disable sqlite, as FreeBSD ships it with disabled double quotes. We'll need to fix our tests.
11+
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269889
12+
prepare: |
13+
cd $GITHUB_WORKSPACE
14+
15+
kldload accf_http
16+
pkg install -y \
17+
autoconf \
18+
bison \
19+
gmake \
20+
re2c \
21+
icu \
22+
libiconv \
23+
png \
24+
freetype2 \
25+
enchant2 \
26+
bzip2 \
27+
t1lib \
28+
gmp \
29+
tidyp \
30+
libsodium \
31+
libzip \
32+
libxml2 \
33+
libxslt \
34+
openssl \
35+
oniguruma \
36+
pkgconf \
37+
webp \
38+
libavif \
39+
`#sqlite3` \
40+
curl
41+
42+
./buildconf -f
43+
./configure \
44+
--prefix=/usr/local \
45+
--enable-debug \
46+
--enable-option-checking=fatal \
47+
--enable-fpm \
48+
`#--with-pdo-sqlite` \
49+
--without-sqlite3 \
50+
--without-pdo-sqlite \
51+
--without-pear \
52+
--with-bz2 \
53+
--with-avif \
54+
--with-jpeg \
55+
--with-webp \
56+
--with-freetype \
57+
--enable-gd \
58+
--enable-exif \
59+
--with-zip \
60+
--with-zlib \
61+
--enable-soap \
62+
--enable-xmlreader \
63+
--with-xsl \
64+
--with-libxml \
65+
--enable-shmop \
66+
--enable-pcntl \
67+
--enable-mbstring \
68+
--with-curl \
69+
--enable-sockets \
70+
--with-openssl \
71+
--with-iconv=/usr/local \
72+
--enable-bcmath \
73+
--enable-calendar \
74+
--enable-ftp \
75+
--with-ffi \
76+
--enable-zend-test \
77+
--enable-dl-test=shared \
78+
--enable-intl \
79+
--with-mhash \
80+
--with-sodium \
81+
--enable-werror \
82+
--with-config-file-path=/etc \
83+
--with-config-file-scan-dir=/etc/php.d
84+
gmake -j2
85+
mkdir /etc/php.d
86+
gmake install > /dev/null
87+
echo opcache.enable_cli=1 > /etc/php.d/opcache.ini
88+
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
89+
echo opcache.preload_user=root >> /etc/php.d/opcache.ini
90+
run: |
91+
cd $GITHUB_WORKSPACE
92+
93+
export SKIP_IO_CAPTURE_TESTS=1
94+
export CI_NO_IPV6=1
95+
export STACK_LIMIT_DEFAULTS_CHECK=1
96+
sapi/cli/php run-tests.php \
97+
-P -q -j2 \
98+
-g FAIL,BORK,LEAK,XLEAK \
99+
--no-progress \
100+
--offline \
101+
--show-diff \
102+
--show-slow 1000 \
103+
--set-timeout 120 \
104+
-d zend_extension=opcache.so

.github/workflows/nightly.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,12 +728,14 @@ jobs:
728728
with:
729729
withMysqli: ${{ inputs.libmysqlclient_with_mysqli }}
730730
- name: Build mysql-8.4
731+
if: ${{ !inputs.libmysqlclient_with_mysqli }}
731732
uses: ./.github/actions/build-libmysqlclient
732733
with:
733734
configurationParameters: ${{ !inputs.libmysqlclient_with_mysqli && '--enable-werror' || '' }}
734735
libmysql: mysql-8.4.0-linux-glibc2.28-x86_64.tar.xz
735736
withMysqli: ${{ inputs.libmysqlclient_with_mysqli }}
736737
- name: Test mysql-8.4
738+
if: ${{ !inputs.libmysqlclient_with_mysqli }}
737739
uses: ./.github/actions/test-libmysqlclient
738740
with:
739741
withMysqli: ${{ inputs.libmysqlclient_with_mysqli }}
@@ -893,3 +895,13 @@ jobs:
893895
run: .github/scripts/windows/build.bat
894896
- name: Test
895897
run: .github/scripts/windows/test.bat
898+
FREEBSD:
899+
name: FREEBSD
900+
runs-on: ubuntu-latest
901+
steps:
902+
- name: git checkout
903+
uses: actions/checkout@v4
904+
with:
905+
ref: ${{ inputs.branch }}
906+
- name: FreeBSD
907+
uses: ./.github/actions/freebsd

.github/workflows/push.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,11 @@ jobs:
359359
name: profiles
360360
path: ${{ github.workspace }}/benchmark/profiles
361361
retention-days: 30
362+
FREEBSD:
363+
name: FREEBSD
364+
runs-on: ubuntu-latest
365+
steps:
366+
- name: git checkout
367+
uses: actions/checkout@v4
368+
- name: FreeBSD
369+
uses: ./.github/actions/freebsd

Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error7.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ class Bar extends Foo
1515

1616
?>
1717
--EXPECTF--
18-
Fatal error: Type of Bar::$property1 must not be defined (as in class Foo) in %s on line %d
18+
Fatal error: Type of Bar::$property1 must be omitted to match the parent definition in class Foo in %s on line %d

Zend/tests/type_declarations/typed_properties_035.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class Baz extends Foo{
1111
}
1212
?>
1313
--EXPECTF--
14-
Fatal error: Type of Baz::$bar must not be defined (as in class Foo) in %s on line 6
14+
Fatal error: Type of Baz::$bar must be omitted to match the parent definition in class Foo in %s on line 6

Zend/zend_inheritance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
15071507
}
15081508
} else if (UNEXPECTED(ZEND_TYPE_IS_SET(child_info->type) && !ZEND_TYPE_IS_SET(parent_info->type))) {
15091509
zend_error_noreturn(E_COMPILE_ERROR,
1510-
"Type of %s::$%s must not be defined (as in class %s)",
1510+
"Type of %s::$%s must be omitted to match the parent definition in class %s",
15111511
ZSTR_VAL(ce->name),
15121512
ZSTR_VAL(key),
15131513
ZSTR_VAL(parent_info->ce->name));

ext/ldap/ldap.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,13 +3759,23 @@ static zend_string* php_ldap_do_escape(const bool *map, const char *value, size_
37593759
zend_string *ret;
37603760

37613761
for (i = 0; i < valuelen; i++) {
3762-
len += (map[(unsigned char) value[i]]) ? 3 : 1;
3762+
size_t addend = (map[(unsigned char) value[i]]) ? 3 : 1;
3763+
if (len > ZSTR_MAX_LEN - addend) {
3764+
return NULL;
3765+
}
3766+
len += addend;
37633767
}
37643768
/* Per RFC 4514, a leading and trailing space must be escaped */
37653769
if ((flags & PHP_LDAP_ESCAPE_DN) && (value[0] == ' ')) {
3770+
if (len > ZSTR_MAX_LEN - 2) {
3771+
return NULL;
3772+
}
37663773
len += 2;
37673774
}
37683775
if ((flags & PHP_LDAP_ESCAPE_DN) && ((valuelen > 1) && (value[valuelen - 1] == ' '))) {
3776+
if (len > ZSTR_MAX_LEN - 2) {
3777+
return NULL;
3778+
}
37693779
len += 2;
37703780
}
37713781

@@ -3832,7 +3842,13 @@ PHP_FUNCTION(ldap_escape)
38323842
php_ldap_escape_map_set_chars(map, ignores, ignoreslen, 0);
38333843
}
38343844

3835-
RETURN_NEW_STR(php_ldap_do_escape(map, value, valuelen, flags));
3845+
zend_string *result = php_ldap_do_escape(map, value, valuelen, flags);
3846+
if (UNEXPECTED(!result)) {
3847+
zend_argument_value_error(1, "is too long");
3848+
RETURN_THROWS();
3849+
}
3850+
3851+
RETURN_NEW_STR(result);
38363852
}
38373853

38383854
#ifdef STR_TRANSLATION
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
GHSA-g665-fm4p-vhff (OOB access in ldap_escape)
3+
--EXTENSIONS--
4+
ldap
5+
--INI--
6+
memory_limit=-1
7+
--SKIPIF--
8+
<?php
9+
if (PHP_INT_SIZE !== 4) die("skip only for 32-bit");
10+
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
11+
?>
12+
--FILE--
13+
<?php
14+
try {
15+
ldap_escape(' '.str_repeat("#", 1431655758), "", LDAP_ESCAPE_DN);
16+
} catch (ValueError $e) {
17+
echo $e->getMessage(), "\n";
18+
}
19+
20+
try {
21+
ldap_escape(str_repeat("#", 1431655758).' ', "", LDAP_ESCAPE_DN);
22+
} catch (ValueError $e) {
23+
echo $e->getMessage(), "\n";
24+
}
25+
?>
26+
--EXPECT--
27+
ldap_escape(): Argument #1 ($value) is too long
28+
ldap_escape(): Argument #1 ($value) is too long
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
GHSA-g665-fm4p-vhff (OOB access in ldap_escape)
3+
--EXTENSIONS--
4+
ldap
5+
--INI--
6+
memory_limit=-1
7+
--SKIPIF--
8+
<?php
9+
if (PHP_INT_SIZE !== 4) die("skip only for 32-bit");
10+
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
11+
?>
12+
--FILE--
13+
<?php
14+
try {
15+
ldap_escape(str_repeat("*", 1431655759), "", LDAP_ESCAPE_FILTER);
16+
} catch (ValueError $e) {
17+
echo $e->getMessage(), "\n";
18+
}
19+
20+
// would allocate a string of length 2
21+
try {
22+
ldap_escape(str_repeat("*", 1431655766), "", LDAP_ESCAPE_FILTER);
23+
} catch (ValueError $e) {
24+
echo $e->getMessage(), "\n";
25+
}
26+
?>
27+
--EXPECT--
28+
ldap_escape(): Argument #1 ($value) is too long
29+
ldap_escape(): Argument #1 ($value) is too long

0 commit comments

Comments
 (0)