summaryrefslogtreecommitdiff
path: root/ext/standard/image.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-11-05 18:16:32 +0100
committerAnatol Belski <ab@php.net>2015-11-05 18:16:32 +0100
commitf189353178bd8e88bee9590669dfd0c53b784b28 (patch)
treec39b6adcac4c0123ef21f9f0fa3f5de4c78ffe00 /ext/standard/image.c
parent5ac288bcc6b8858e3ea509d92426b2bacc7fd397 (diff)
downloadphp-git-f189353178bd8e88bee9590669dfd0c53b784b28.tar.gz
fix possible NULL deref in image functions
Diffstat (limited to 'ext/standard/image.c')
-rw-r--r--ext/standard/image.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 378423917e..7f100d68f9 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -217,11 +217,16 @@ static struct gfxinfo *php_handle_swc(php_stream * stream)
if (uncompress(b, &len, a, sizeof(a)) != Z_OK) {
/* failed to decompress the file, will try reading the rest of the file */
- if (php_stream_seek(stream, 8, SEEK_SET))
+ if (php_stream_seek(stream, 8, SEEK_SET)) {
return NULL;
+ }
bufz = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0);
+ if (!bufz) {
+ return NULL;
+ }
+
/*
* zlib::uncompress() wants to know the output data length
* if none was given as a parameter