Commit 4cfcc8e
committed
deepclone_from_array: reject building an uninitialized object
deepclone_to_array() always emits a class that has __unserialize() as a
negative-wakeup state replay. A hand-crafted payload that instead flags
such a class for plain creation (wakeup >= 0, no replay) made from_array()
build a bare object_init_ex() shell that __unserialize() never
initialized — for BcMath\Number that shell has a NULL bc_num, so any
operation on it crashed.
Reject such a payload with a ValueError before creating the object, so no
uninitialized shell is ever built. A php-src guard for the bcmath case
(php/php-src#22259) was declined: an uninitialized BcMath\Number cannot be
reached from userland, so the extension must not produce one. The test
that exercised the crash path now asserts the rejection instead.1 parent d4beb94 commit 4cfcc8e
2 files changed
Lines changed: 21 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3365 | 3365 | | |
3366 | 3366 | | |
3367 | 3367 | | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
3368 | 3377 | | |
3369 | 3378 | | |
3370 | 3379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 67 | + | |
0 commit comments