Fix bug #68571 : core dump when webserver close the socket#948
Merged
php-pulls merged 2 commits intophp:PHP-5.5from Jan 27, 2015
Merged
Fix bug #68571 : core dump when webserver close the socket#948php-pulls merged 2 commits intophp:PHP-5.5from
php-pulls merged 2 commits intophp:PHP-5.5from
Conversation
Contributor
Author
|
According to the fastcgi protocol(http://www.fastcgi.com/devkit/doc/fcgi-spec.html), I write a php client to talk with php directly. server code(/home/users/xxx/test/index.php) is here: fastcgi client code is here: |
sapi/fpm/fpm/fpm_main.c
Outdated
Member
There was a problem hiding this comment.
break C89 here... move the declaration to the top please.
Contributor
Author
There was a problem hiding this comment.
Yes, I will fix it. thank niaoge
Member
|
已经提交, 感谢你的Fix(Merged thanks) :) |
|
@laruence why not merged into PHP 5.4 branch? |
Member
|
@netroby 5.4 is in only security fix status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the bug is here: https://bugs.php.net/bug.php?id=68571
There is several conditions when core dump
1 don't use error_log in php.ini.
2 a lot of stderr log generate
3 webserver close the socket after send the request(request timeout will lead the action)
from the code of php, we know that
1 output is base a buffer(out_buf)
2 out_pos point to the last address, out_pos - out_buf <= 8192 (the buffer's length)
3 if out_hdr is NULL, we let out_pos add sizeof(fcgi_header)
4 before write data to client, we will reset out_hdr to NULL(in function close_packet)
but when write stderr to client failed, there are two mistake
1 we don't reset the pos of out_pos
2 we don't check the return value of fcgi_write
so out_pos add more and more sizeof(fcgi_header) until address out of bounds and core dump
I rest the pos of out_pos and check the return value of fcgi_write in my PR