mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix #81294: Segfault when removing a filter
We need to call the proper method. Closes GH-7308.
This commit is contained in:
parent
387c0de983
commit
1fa26eccba
3 changed files with 28 additions and 1 deletions
3
NEWS
3
NEWS
|
@ -22,6 +22,9 @@ PHP NEWS
|
|||
(George Dietrich)
|
||||
. Fixed bug #74960 (Heap buffer overflow via str_repeat). (cmb, Dmitry)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #81294 (Segfault when removing a filter). (cmb)
|
||||
|
||||
29 Jul 2021, PHP 7.4.22
|
||||
|
||||
- Core:
|
||||
|
|
24
ext/standard/tests/filters/bug81294.phpt
Normal file
24
ext/standard/tests/filters/bug81294.phpt
Normal file
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
Bug #81294 (Segfault when removing a filter)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('zlib')) die("skip zlib extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$f = fopen(__DIR__ . "/bug81294.txt", "wb+");
|
||||
$flt1 = stream_filter_append($f, "zlib.deflate", STREAM_FILTER_WRITE);
|
||||
$flt2 = stream_filter_append($f, "string.rot13", STREAM_FILTER_WRITE);
|
||||
fwrite($f, "test");
|
||||
stream_filter_remove($flt1);
|
||||
fwrite($f, "test");
|
||||
stream_filter_remove($flt2);
|
||||
rewind($f);
|
||||
var_dump(urlencode(fread($f, 1024)));
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . "/bug81294.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(16) "%2BV-.%01%00grfg"
|
|
@ -418,7 +418,7 @@ PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish)
|
|||
for(current = filter; current; current = current->next) {
|
||||
php_stream_filter_status_t status;
|
||||
|
||||
status = filter->fops->filter(stream, current, inp, outp, NULL, flags);
|
||||
status = current->fops->filter(stream, current, inp, outp, NULL, flags);
|
||||
if (status == PSFS_FEED_ME) {
|
||||
/* We've flushed the data far enough */
|
||||
return SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue