View Issue Details

IDProjectCategoryView StatusLast Update
0001790XdebugStep Debuggingpublic2020-05-28 14:38
Reporterdustinmailc Assigned To 
PriorityhighSeveritycrashReproducibilityalways
Status closedResolutionfixed 
OSLinuxOS VersionDebian 
Product Version2.9.5 
Fixed in Version2.9.6 
Summary0001790: Segfault in var_dump() or while debugging with protobuf extension
Description

While debugging scripts with classes that use the protobuf extension, the php interpreter segfaults reliably when xdebug inspects instances of classes from the extension. The crash also occurs when calling var_dump() with xdebug's var_dump() override enabled. This crash prevents us from using step debugging when the protobuf extension is enabled.

Steps To Reproduce

Since this requires a separate extension to reproduce, I put together a containerized demonstration of this here: https://github.com/dcloues/xdebug-protobuf-segfault

I used the protobuf extension for this, but I believe the crash will occur with any internal class that has a get_properties() handler that returns null.

Additional Information

I tested adding a null check here: https://github.com/xdebug/xdebug/blob/00a928eb760833a07e01a7b17cc040e4f3a8a077/src/lib/var_export_text.c#L250 which seems to resolve the issue. I'd be happy to open a pull request for this change.

TagsSIGSEGV
Operating SystemDebian Linux
PHP Version7.4.0-7.4.4

Activities

dustinmailc

2020-05-26 15:07

reporter   ~0005416

I forgot to include a gdb backtrace from this - sorry about that! I attached it here.

derick

2020-05-28 09:17

administrator   ~0005417

Hi Dustin,

thanks for the report. It was quite easy to reproduce, even without Docker. However, the fix (https://github.com/xdebug/xdebug/commit/009c26f723ab7680084b90401de17aaeee35c386) wasn't as easy as just adding the test for null on the line that you indicated. In the end, it needed to be done in different places making sure that it wouldn't also ignore the whole class.

The fix for this report has just been merged into xdebug_2_9 for the 2.9.6 release, as well as into master.

thanks!

cheers,
Derick

dustinmailc

2020-05-28 14:38

reporter   ~0005421

Thanks so much! I (and my coworkers) really appreciate it.