Bug #81294 [NEW]: Segfault when removing a filter

From: Date: Sun, 25 Jul 2021 19:13:37 +0000
Subject: Bug #81294 [NEW]: Segfault when removing a filter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235337@lists.php.net to get a copy of this message
From:             ivo dot andonov at gmail dot com
Operating system: Linux / Windows
PHP version:      8.0.8
Package:          Filter related
Bug Type:         Bug
Bug description:Segfault when removing a filter

Description:
------------
This one seems to be sourced back since quite some time (at least from
5.6.30 till 8.0.8). Right now I do not have the time for posting too
many details but it should be pretty clear to understand by looking at
streams/filter.c, function _php_stream_filter_flush, then the loop with
current = filter and then referencing filter->fops->filter() instead of
current->fops->filter().



Test script:
---------------
class some_user_filter {
...
}
stream_filter_register("some.filter", "some_user_filter");
$f = fopen("test", "wb");
$flt1 = stream_filter_append($f, "zlib.deflate", STREAM_FILTER_WRITE);
$flt2 = stream_filter_append($f, "some.filter", STREAM_FILTER_WRITE);
fwrite($f, "test");
stream_filter_remove($flt1); // this line will fail and at the end of
the script a segfault / or MS Don't send / access violation
fwrite($f, "test"1);



-- 
Edit bug report at https://bugs.php.net/bug.php?id=81294&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81294&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81294&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81294&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81294&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81294&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81294&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81294&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81294&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81294&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81294&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81294&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81294&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81294&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81294&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81294&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81294&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81294&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#235337) next »