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 on mysqlnd result set error #1858

Closed
wants to merge 2 commits into from

Conversation

@soda0289
Copy link

soda0289 commented Apr 11, 2016

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

This comment has been minimized.

Copy link
Author

soda0289 commented Apr 11, 2016

@laruence laruence added the Bugfix label Apr 12, 2016
@weltling

This comment has been minimized.

Copy link
Contributor

weltling commented Apr 16, 2016

@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 soda0289:fix-mysqlnd-result-error branch from 1646ce3 to c624d70 Apr 18, 2016
This test ensures there is no segfault when there is an error
on an EXPLAIN SELECT query.
@soda0289 soda0289 force-pushed the soda0289:fix-mysqlnd-result-error branch from c624d70 to f500e78 Apr 18, 2016
@soda0289

This comment has been minimized.

Copy link
Author

soda0289 commented Apr 18, 2016

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

This comment has been minimized.

Copy link
Author

soda0289 commented Apr 18, 2016

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

@nikic

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

soda0289 commented Jul 25, 2016

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

@nikic

This comment has been minimized.

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
4 participants
You can’t perform that action at this time.