From: Anatol Belski Date: Fri, 19 Sep 2014 07:49:32 +0000 (+0200) Subject: fix conditions X-Git-Tag: POST_NATIVE_TLS_MERGE^2~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79bb2a14743606e9593c88fce9a7a1e9791120c2;p=php fix conditions --- diff --git a/ext/standard/image.c b/ext/standard/image.c index b2b5dcd369..df767528a9 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -367,7 +367,7 @@ static unsigned short php_read2(php_stream * stream TSRMLS_DC) unsigned char a[2]; /* just return 0 if we hit the end-of-file */ - if((php_stream_read(stream, (char*)a, sizeof(a))) <= 0) return 0; + if((php_stream_read(stream, (char*)a, sizeof(a))) != sizeof(a)) return 0; return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]); } @@ -647,7 +647,7 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream TSRMLS_DC) #endif result->channels = php_read2(stream TSRMLS_CC); /* Csiz */ - if (result->channels < 0 || result->channels > 256) { + if (result->channels == 0 || result->channels > 256) { efree(result); return NULL; }