Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfault when function parameter is overwritten #1665 #472

Closed
wants to merge 10 commits into from

Conversation

Projects
None yet
2 participants
@SpyroTEQ
Copy link

commented May 14, 2019

This fixes the segfault when the variable passed to a function got GCed by PHP when xdebug tries to dump it
I'm not sure I'm using the GC_REFCOUNT in a proper way tho... The lower bound (0) seems legit, but the upperbound (255) is actually there because GC_COUNT can return "random" numbers when the variable has been GCed...

if you have a better way of checking whether the variable has been GCed, please say so!
https://bugs.xdebug.org/view.php?id=1665

@SpyroTEQ

This comment has been minimized.

Copy link
Author

commented May 14, 2019

I'll leave the erroneous "uint32_t" (worked on windows+Visual C++ tho, so I'm surprise it fails here?) because the GC_REFCOUNT usage needs to be reworked too.

SpyroTEQ added some commits May 15, 2019

Fixed issue #1665: Segfault when function parameter is overwritten (l…
…ock the GC of the objects until stack frame is removed)
Fixed issue #1665: Segfault when function parameter is overwritten (l…
…ock the GC of the objects until stack frame is removed)
Show resolved Hide resolved .gitignore Outdated
@SpyroTEQ

This comment has been minimized.

Copy link
Author

commented May 15, 2019

I don't get why GC_DELREF fails... Is it PHP 7.3+ only code? Is there a doc where I can check that (and find a way to make PHP 7.1/7.2 make pass)?

/home/circleci/project/xdebug.c:1958:3: error: implicit declaration of function ‘GC_DELREF’ [-Werror=implicit-function-declaration]
   GC_DELREF(fse->gc_locked_objects[i]);
   ^~~~~~~~~

SpyroTEQ added some commits May 15, 2019

Fixed issue #1665: Segfault when function parameter is overwritten (c…
…entralize unlocking and call it in the two places "add frame" was called)
Fixed issue #1665: Segfault when function parameter is overwritten (t…
…ry compatibility with PHP 7.2/7.1; I'm not 100% sure about the version number)
Fixed issue #1665: Segfault when function parameter is overwritten
Unused variable (told you I'm messy, it's my very 1st contribution : ) )
@SpyroTEQ

This comment has been minimized.

Copy link
Author

commented May 15, 2019

I've cleaned things up, following properly the "contributing" rules. So I close this pull request, and let you see the clean one at #473

@SpyroTEQ SpyroTEQ closed this May 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.