Merge pull request #18302 from jerrycmh/segfault

PHP: fixed seg fault caused by access client after it is closed
pull/18333/head
Stanley Cheung 6 years ago committed by GitHub
commit 97a59fca3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/php/ext/grpc/call.c

@ -217,6 +217,12 @@ PHP_METHOD(Call, __construct) {
} }
wrapped_grpc_channel *channel = wrapped_grpc_channel *channel =
PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_channel, channel_obj); PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_channel, channel_obj);
if (channel->wrapper == NULL) {
zend_throw_exception(spl_ce_InvalidArgumentException,
"Call cannot be constructed from a closed Channel",
1 TSRMLS_CC);
return;
}
gpr_mu_lock(&channel->wrapper->mu); gpr_mu_lock(&channel->wrapper->mu);
if (channel->wrapper == NULL || channel->wrapper->wrapped == NULL) { if (channel->wrapper == NULL || channel->wrapper->wrapped == NULL) {
zend_throw_exception(spl_ce_InvalidArgumentException, zend_throw_exception(spl_ce_InvalidArgumentException,

Loading…
Cancel
Save