fix segfault if filter could not be located
authorMichael Wallner <mike@php.net>
Fri, 2 Mar 2018 12:35:52 +0000 (13:35 +0100)
committerMichael Wallner <mike@php.net>
Fri, 2 Mar 2018 12:35:52 +0000 (13:35 +0100)
src/php_http_env_response.c

index ab959f31ba6d838066c062f27d9a94980bacfab9..40ef4fee60d2b9171e78eb4fe08d05399f6fd14a 100644 (file)
@@ -938,7 +938,9 @@ static ZEND_RESULT_CODE php_http_env_response_stream_start(php_http_env_response
 
        if (ctx->chunked) {
                ctx->chunked_filter = php_stream_filter_create("http.chunked_encode", NULL, 0);
-               php_stream_filter_append(&ctx->stream->writefilters, ctx->chunked_filter);
+               if (ctx->chunked_filter) {
+                       php_stream_filter_append(&ctx->stream->writefilters, ctx->chunked_filter);
+               }
        }
 
        return ctx->started ? SUCCESS : FAILURE;