Skip to content

Fix segfault on mysqlnd result set error #1858

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

Closed
wants to merge 2 commits into from

Conversation

soda0289
Copy link

This patch fixes bug# 71863 which caused a segfault when the result set
contained an error. This occurs becuase the buffered result set does
not contain callbacks in its mysqlnd error_info struct and would fail
on a null pointer when called with the macro COPY_CLIENT_ERROR.

The fix simply copies the error info struct from the row_packet into
the buffered result set, as was done before.

This patch fixes bug# 71863 which caused a segfault when the result set
contained an error. This occurs becuase the buffered result set does
not contain callbacks in its mysqlnd error_info struct and would fail
on a null pointer when called with the macro COPY_CLIENT_ERROR.

The fix simply copies the error info struct from the row_packet into
the buffered result set, as was done before.
@soda0289
Copy link
Author

@laruence laruence added the Bug label Apr 12, 2016
@weltling
Copy link
Contributor

@soda0289 there is the test code in the ticket, could you please add it as a phpt to the PR?

Thanks.

@soda0289 soda0289 force-pushed the fix-mysqlnd-result-error branch from 1646ce3 to c624d70 Compare April 18, 2016 15:25
This test ensures there is no segfault when there is an error
on an EXPLAIN SELECT query.
@soda0289 soda0289 force-pushed the fix-mysqlnd-result-error branch from c624d70 to f500e78 Compare April 18, 2016 15:26
@soda0289
Copy link
Author

I have added a test that reproduces the segmentation fault. This error only occurs on master and not on PHP-7.0.5 or PHP-7.0.6.

@soda0289
Copy link
Author

I believe the bug was introduced in this commit 4bb784c.

@nikic
Copy link
Member

nikic commented Jul 22, 2016

This has now been fixed via 671d22f in a different way (calling mysqlnd_error_info_init).

@nikic nikic closed this Jul 22, 2016
@soda0289
Copy link
Author

@nikic Will this be merged into PHP-7.1 branch?

@nikic
Copy link
Member

nikic commented Jul 25, 2016

@soda0289 Looks like the change on the 7.1 branch didn't get pushed upstream. I've now cherry-picked the commit: b27ff62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants