Fix #79571: FFI: var_dumping unions may segfault#5538
Fix #79571: FFI: var_dumping unions may segfault#5538cmb69 wants to merge 1 commit intophp:PHP-7.4from
Conversation
We must not attempt to access arbitrary union members when retrieving debug info, because that may not be valid. We report unions as empty instead.
|
actually, while using FFI, you have thousands ways to shoot your feet, user should avoid such things by themself. back to this fix, maybe we should give a warning about “you should specify which item in union you want dumping?” |
The union can be part of a larger structure, in which case there is no way to specify the active member. I think this fix is okay. An alternative would be to dump all members without dereferencing them (that is, for pointers only print the pointer address). This would be similar to what gdb does... |
|
The last Nikita's idea looks better, but this solution is also OK. |
|
“dump all members without dereferencing them” is better to me too. thanks |
|
Okay, I'll have a look at that. Thanks! |
|
Thanks for your replies!!! |
|
Closing in favor of PR #5544. |
We must not attempt to access arbitrary union members when retrieving
debug info, because that may not be valid. We report unions as empty
instead.