summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-09-19 09:49:32 +0200
committerAnatol Belski <ab@php.net>2014-09-19 09:49:32 +0200
commit79bb2a14743606e9593c88fce9a7a1e9791120c2 (patch)
treece2ea287cb541ee7d4af82d169563c5e3facb5b3 /ext
parent6fab9079209ac6152f858d24a074d2447c6694df (diff)
downloadphp-git-79bb2a14743606e9593c88fce9a7a1e9791120c2.tar.gz
fix conditions
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/image.c4
1 files changed, 2 insertions, 2 deletions
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;
}