summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Hagstrand <mhagstrand@gmail.com>2017-01-21 12:40:15 -0800
committerJoe Watkins <krakjoe@php.net>2017-01-22 06:40:55 +0000
commite56fe7e5e7a926bfdf142a7a844544c0127e92b7 (patch)
treed77906b4330be497484a2a40320fca4255a76a5e
parent42d53f3bc04ca089ebb7f1452bd998c05b7ff520 (diff)
downloadphp-git-e56fe7e5e7a926bfdf142a7a844544c0127e92b7.tar.gz
Fix intermittent segfault in GD library
The gdIOCtx struct should be zero filled with ecalloc. emalloc does not zero fill the struct.
-rw-r--r--ext/gd/gd_ctx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index dd62c63664..388d66106e 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -152,7 +152,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
RETURN_FALSE;
}
} else {
- ctx = emalloc(sizeof(gdIOCtx));
+ ctx = ecalloc(1, sizeof(gdIOCtx));
ctx->putC = _php_image_output_putc;
ctx->putBuf = _php_image_output_putbuf;
ctx->gd_free = _php_image_output_ctxfree;
@@ -165,7 +165,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
}
if (!ctx) {
- ctx = emalloc(sizeof(gdIOCtx));
+ ctx = ecalloc(1, sizeof(gdIOCtx));
ctx->putC = _php_image_stream_putc;
ctx->putBuf = _php_image_stream_putbuf;
if (close_stream) {