Skip to content

Commit 6dcb5eb

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents ae47816 + 1fb4e57 commit 6dcb5eb

21 files changed

+289
-37
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ scattered across different websites, and often outdated. Nonetheless, they can
100100
provide a good starting point for learning about the fundamentals of the code
101101
base.
102102

103+
* https://php.github.io/php-src/
103104
* https://www.phpinternalsbook.com/
104105
* https://www.npopov.com/
105106
* [Internal value representation](https://www.npopov.com/2015/05/05/Internal-value-representation-in-PHP-7-part-1.html), [part 2](https://www.npopov.com/2015/06/19/Internal-value-representation-in-PHP-7-part-2.html)

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ PHP NEWS
5050
- Streams:
5151
. Added so_reuseaddr streams context socket option that allows disabling
5252
address resuse.
53+
. Fixed bug GH-20370 (User stream filters could violate typed property
54+
constraints). (alexandre-daubois)
5355

5456
- Zip:
5557
. Fixed ZipArchive callback being called after executor has shut down.

Zend/zend_weakrefs.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,7 @@ ZEND_METHOD(WeakMap, offsetUnset)
776776

777777
ZEND_METHOD(WeakMap, count)
778778
{
779-
if (zend_parse_parameters_none() == FAILURE) {
780-
RETURN_THROWS();
781-
}
779+
ZEND_PARSE_PARAMETERS_NONE();
782780

783781
zend_long count;
784782
zend_weakmap_count_elements(Z_OBJ_P(ZEND_THIS), &count);
@@ -787,9 +785,7 @@ ZEND_METHOD(WeakMap, count)
787785

788786
ZEND_METHOD(WeakMap, getIterator)
789787
{
790-
if (zend_parse_parameters_none() == FAILURE) {
791-
RETURN_THROWS();
792-
}
788+
ZEND_PARSE_PARAMETERS_NONE();
793789

794790
zend_create_internal_iterator_zval(return_value, ZEND_THIS);
795791
}

docs/release-process.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ slightly different steps. We'll call attention where the steps differ.
169169
4. Using your local-only release branch, bump the version numbers in
170170
`main/php_version.h`, `Zend/zend.h`, `configure.ac`, and possibly
171171
`NEWS`.
172-
172+
173173
The date for NEWS should be the date of the announcement (Thursday),
174174
*not* the date of the tagging (Tuesday).
175-
175+
176176
For examples, see [Update versions for PHP 8.1.0beta3][] (for a pre-GA
177177
example) or [Update versions for PHP 8.1.6RC1][] along with
178178
[Update NEWS for PHP 8.1.6RC1][] (for a post-GA example).
@@ -506,8 +506,8 @@ slightly different steps. We'll call attention where the steps differ.
506506
You can send a PR to [toot-together](https://github.com/derickr/toot-together/)
507507
with highlights from the NEWS file yourself, if you want.
508508
509-
* [Annonce 8.5.0alpha1](https://github.com/derickr/toot-together/pull/42)
510-
* [Annonce 8.5.0alpha2](https://github.com/derickr/toot-together/pull/47)
509+
* [Announce 8.5.0alpha1](https://github.com/derickr/toot-together/pull/42)
510+
* [Announce 8.5.0alpha2](https://github.com/derickr/toot-together/pull/47)
511511
512512
We post to [@php@fosstodon.org](https://fosstodon.org/@php).
513513

docs/source/miscellaneous/stubs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ generated. You can include this file conditionally, such as:
489489
#endif
490490
491491
When ``@generate-legacy-arginfo`` is passed the minimum PHP version ID that needs to be supported,
492-
then only one arginfo file is going to be generated, and ``#if`` prepocessor directives will ensure
492+
then only one arginfo file is going to be generated, and ``#if`` preprocessor directives will ensure
493493
compatibility with all the required PHP 8 versions.
494494

495495
PHP Version IDs are as follows: ``80000`` for PHP 8.0, ``80100`` for PHP PHP 8.1, ``80200`` for PHP

docs/source/miscellaneous/writing-tests.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ below illustrates a minimal test.
132132
string(32) "# hello All, I sAid hi planet! #"
133133
134134
As you can see the file is divided into several sections. The TEST section holds a one line title of
135-
the phpt test, this should be a simple description and shouldn't ever excede one line, if you need
135+
the phpt test, this should be a simple description and shouldn't ever exceed one line, if you need
136136
to write more explanation add comments in the body of the test case. The phpt files name is used
137137
when generating a .php file. The FILE section is used as the body of the .php file, so don't forget
138138
to open and close your php tags. The EXPECT section is the part used as a comparison to see if the
@@ -580,7 +580,7 @@ Example 1 (snippet):
580580
.. code:: text
581581
582582
--DESCRIPTION--
583-
This test covers both valid and invalid usages of filter_input() with INPUT_GET and INPUT_POST data and several differnet filter sanitizers.
583+
This test covers both valid and invalid usages of filter_input() with INPUT_GET and INPUT_POST data and several different filter sanitizers.
584584
585585
Example 1 (full): :ref:`sample001.phpt`
586586

@@ -1310,7 +1310,7 @@ Example 1 (full): :ref:`sample017.phpt`
13101310
``--FLAKY--``
13111311
-------------
13121312

1313-
**Description:** This section identifies this test as one that occassionally fails. If the test
1313+
**Description:** This section identifies this test as one that occasionally fails. If the test
13141314
actually fails, it will be retried one more time, and that result will be reported. The section
13151315
should include a brief description of why the test is flaky. Reasons for this include tests that
13161316
rely on relatively precise timing, or temporary disc states. Available as of PHP 8.1.22 and 8.2.9,
@@ -1884,7 +1884,7 @@ sample001.phpt
18841884
--DESCRIPTION--
18851885
This test covers both valid and invalid usages of
18861886
filter_input() with INPUT_GET and INPUT_POST data
1887-
and several differnt filter sanitizers.
1887+
and several different filter sanitizers.
18881888
--CREDITS--
18891889
Felipe Pena <felipe@php.net>
18901890
--INI--

ext/bz2/bz2.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,15 @@ PHP_FUNCTION(bzcompress)
476476
+ .01 x length of data + 600 which is the largest size the results of the compression
477477
could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
478478
for pointing this out). */
479-
// TODO Check source string length fits in unsigned int
480-
dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600);
479+
size_t chunk_len = source_len + source_len / 100 + 600;
480+
const size_t min = MIN(ZSTR_MAX_LEN, UINT_MAX);
481+
482+
if (chunk_len < source_len || chunk_len > min) {
483+
zend_argument_value_error(1, "must have a length less than or equal to %zu", min);
484+
RETURN_THROWS();
485+
}
486+
487+
dest_len = (unsigned int) chunk_len;
481488

482489
/* Allocate the destination buffer */
483490
dest = zend_string_alloc(dest_len, 0);

ext/bz2/tests/gh20620.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug GH-20620 (bzcompress with large source)
3+
--EXTENSIONS--
4+
bz2
5+
--SKIPIF--
6+
<?php
7+
if (PHP_INT_SIZE != 8) die('skip this test is for 64bit platforms only');
8+
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
9+
?>
10+
--INI--
11+
memory_limit=-1
12+
--FILE--
13+
<?php
14+
try {
15+
bzcompress(str_repeat('1', 4295163906));
16+
} catch (\ValueError $e) {
17+
echo $e->getMessage(), PHP_EOL;
18+
}
19+
?>
20+
--EXPECTF--
21+
bzcompress(): Argument #1 ($data) must have a length less than or equal to %d

ext/exif/exif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4421,7 +4421,7 @@ static bool exif_scan_HEIF_header(image_info_type *ImageInfo, unsigned char *buf
44214421
if (exif_read_from_stream_file_looped(ImageInfo->infile, (char*)(data + remain), limit - remain) == limit - remain) {
44224422
exif_isobmff_parse_meta(data, data + limit, &pos);
44234423
}
4424-
if ((pos.size) &&
4424+
if ((pos.size >= 2) &&
44254425
(pos.size < ImageInfo->FileSize) &&
44264426
(ImageInfo->FileSize - pos.size >= pos.offset) &&
44274427
(php_stream_seek(ImageInfo->infile, pos.offset + 2, SEEK_SET) >= 0)) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
HEIC iloc extent_length underflow
3+
--EXTENSIONS--
4+
exif
5+
--FILE--
6+
<?php
7+
// Read valid HEIC file and patch iloc extent_length to 1
8+
$data = file_get_contents(__DIR__."/image029.heic");
9+
$data = substr_replace($data, "\x00\x00\x00\x01", 0x4f8, 4);
10+
file_put_contents(__DIR__."/heic_iloc_underflow.heic", $data);
11+
var_dump(exif_read_data(__DIR__."/heic_iloc_underflow.heic"));
12+
?>
13+
--CLEAN--
14+
<?php
15+
@unlink(__DIR__."/heic_iloc_underflow.heic");
16+
?>
17+
--EXPECTF--
18+
Warning: exif_read_data(heic_iloc_underflow.heic): Invalid HEIF file in %s on line %d
19+
bool(false)

0 commit comments

Comments
 (0)