com php-src: Fix intermittent segfault in GD library: ext/gd/gd_ctx.c
| From: | Joe Watkins | Date: | Sun, 22 Jan 2017 06:40:55 +0000 |
| Subject: | com php-src: Fix intermittent segfault in GD library: ext/gd/gd_ctx.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96834@lists.php.net to get a copy of this message | ||
Commit: e56fe7e5e7a926bfdf142a7a844544c0127e92b7
Author: Mitch Hagstrand <mhagstrand@gmail.com> Sat, 21 Jan 2017 12:40:15 -0800
Committer: Joe Watkins <krakjoe@php.net> Sun, 22 Jan 2017 06:40:55 +0000
Parents: 42d53f3bc04ca089ebb7f1452bd998c05b7ff520
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e56fe7e5e7a926bfdf142a7a844544c0127e92b7
Log:
Fix intermittent segfault in GD library
The gdIOCtx struct should be zero filled with ecalloc.
emalloc does not zero fill the struct.
Changed paths:
M ext/gd/gd_ctx.c
Diff:
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index dd62c63..388d661 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) {