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

Raylib::updateCamera() segfaults if FFI::addr() is returned from another method #9

Open
nawarian opened this issue Apr 7, 2021 · 0 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@nawarian
Copy link
Owner

nawarian commented Apr 7, 2021

This was found while implementing the Raylib::updateCamera() method. The snippet below can reproduce the issue:

public function updateCamera(Types\Camera3D $camera): void
{
    $cdata = FFI::addr($camera->toCData($this->ffi));
    $this->ffi->UpdateCamera($cdata);
    // ...
}

public function getAddr(\FFI\CData $cdata): \FFI\CData
{
    return FFI::addr($cdata);
}

If $cdata = FFI::addr($camera->toCData($this->ffi)); is replaced with $cdata = $this->getAddr($camera->toCData($this->ffi)); PHP will segfault.

@nawarian nawarian added bug Something isn't working help wanted Extra attention is needed labels Apr 7, 2021
@nawarian nawarian self-assigned this Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant