Commit b4cb516
committed
deepclone_to_array: resolve INDIRECT slots in retained __serialize() states
Before PHP 8.3, Random\Randomizer::__serialize() returns the object's raw
property table with only the table itself addref'd; its "engine" entry is
an IS_INDIRECT slot pointing into the object (fixed for 8.3 by php-src
commit c5fa7696e64, never backported to the by-then security-only 8.2).
deepclone_to_array() walks such a state with dc_copy_array(), which
passed IS_INDIRECT slots to dc_copy_value() unresolved, so the payload
retained pointers into the source object. Once a Randomizer that did not
outlive its payload was released, deepclone_from_array() dereferenced
freed memory and crashed. Resolve indirects (and skip resolved UNDEF
slots) at the start of the walk, exactly like the native serializer and
the existing build_scoped_props loop already do.1 parent e4c510b commit b4cb516
2 files changed
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
967 | 978 | | |
968 | 979 | | |
969 | 980 | | |
| |||
| 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 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
0 commit comments