Commit 46352f7
committed
ext/standard: stream_filter_register() orphaned user_filter_map on shutdown re-registration.
Fix GH-22818
During request shutdown the user_filter_map is torn down by the
user_filters RSHUTDOWN before the streams referencing it are flushed. A
user filter whose filter() callback re-registers the filter recreated the
now-NULL map, then, since the volatile factory was still present in
FG(stream_filters), deleted the freshly added entry and left an empty
orphaned map behind. The following stream_filter_append() located the
factory but no matching fdat, tripping ZEND_ASSERT(fdat), and the
recreated map leaked.
Register the volatile factory first and only create and populate
user_filter_map on success, so a re-registration during the shutdown
window fails without recreating the map. The existing NULL-map guard in
user_filter_factory_create() then handles the append gracefully.1 parent e31d8e0 commit 46352f7
2 files changed
Lines changed: 37 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
604 | 610 | | |
605 | 611 | | |
606 | 612 | | |
607 | 613 | | |
608 | 614 | | |
609 | 615 | | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
| 616 | + | |
| 617 | + | |
617 | 618 | | |
618 | | - | |
| 619 | + | |
619 | 620 | | |
620 | 621 | | |
0 commit comments