Commit 1e4375d
committed
Fix GH-22878: Use-after-free of callable via autoloader
Validating an array or string callable runs user code before its borrowed
method name and object are used: a string class name can trigger an
autoloader, and a compound "Class::method" name emits an E_DEPRECATED that
reaches a user error handler. Either can free or mutate the callable,
leaving the method string and $this dangling. Copy the method string
before the reentrant lookup, and hold the callable array across
INIT_USER_CALL's validation and frame build so the object survives to the
call. This also covers call_user_func_array(), $cb(), and referenced or
reference-wrapped array members.
Fixes GH-228781 parent 68d605f commit 1e4375d
6 files changed
Lines changed: 133 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
| 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 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4179 | 4179 | | |
4180 | 4180 | | |
4181 | 4181 | | |
| 4182 | + | |
| 4183 | + | |
| 4184 | + | |
4182 | 4185 | | |
4183 | 4186 | | |
4184 | 4187 | | |
| |||
4206 | 4209 | | |
4207 | 4210 | | |
4208 | 4211 | | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
4209 | 4215 | | |
4210 | 4216 | | |
4211 | 4217 | | |
4212 | 4218 | | |
4213 | 4219 | | |
| 4220 | + | |
| 4221 | + | |
| 4222 | + | |
4214 | 4223 | | |
4215 | 4224 | | |
4216 | 4225 | | |
| |||
4244 | 4253 | | |
4245 | 4254 | | |
4246 | 4255 | | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
4247 | 4259 | | |
| 4260 | + | |
4248 | 4261 | | |
4249 | 4262 | | |
4250 | 4263 | | |
| |||
4256 | 4269 | | |
4257 | 4270 | | |
4258 | 4271 | | |
| 4272 | + | |
| 4273 | + | |
| 4274 | + | |
4259 | 4275 | | |
4260 | 4276 | | |
4261 | | - | |
4262 | 4277 | | |
4263 | 4278 | | |
4264 | 4279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5008 | 5008 | | |
5009 | 5009 | | |
5010 | 5010 | | |
| 5011 | + | |
5011 | 5012 | | |
5012 | 5013 | | |
5013 | 5014 | | |
| 5015 | + | |
5014 | 5016 | | |
5015 | 5017 | | |
5016 | 5018 | | |
5017 | 5019 | | |
5018 | | - | |
| 5020 | + | |
5019 | 5021 | | |
5020 | | - | |
| 5022 | + | |
5021 | 5023 | | |
5022 | 5024 | | |
5023 | 5025 | | |
5024 | | - | |
| 5026 | + | |
5025 | 5027 | | |
| 5028 | + | |
5026 | 5029 | | |
5027 | 5030 | | |
| 5031 | + | |
5028 | 5032 | | |
5029 | 5033 | | |
5030 | 5034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3906 | 3906 | | |
3907 | 3907 | | |
3908 | 3908 | | |
| 3909 | + | |
3909 | 3910 | | |
3910 | 3911 | | |
3911 | 3912 | | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
3912 | 3919 | | |
3913 | 3920 | | |
3914 | 3921 | | |
| |||
3917 | 3924 | | |
3918 | 3925 | | |
3919 | 3926 | | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
3920 | 3930 | | |
3921 | 3931 | | |
3922 | 3932 | | |
| |||
3940 | 3950 | | |
3941 | 3951 | | |
3942 | 3952 | | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
3943 | 3956 | | |
3944 | 3957 | | |
3945 | 3958 | | |
| |||
3954 | 3967 | | |
3955 | 3968 | | |
3956 | 3969 | | |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
3957 | 3973 | | |
3958 | 3974 | | |
3959 | 3975 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments