com php-src: fix conditions: ext/standard/image.c
| From: | Anatol Belski | Date: | Fri, 19 Sep 2014 07:49:32 +0000 |
| Subject: | com php-src: fix conditions: ext/standard/image.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81761@lists.php.net to get a copy of this message | ||
Commit: 79bb2a14743606e9593c88fce9a7a1e9791120c2
Author: Anatol Belski <ab@php.net> Fri, 19 Sep 2014 09:49:32 +0200
Parents: 6fab9079209ac6152f858d24a074d2447c6694df
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=79bb2a14743606e9593c88fce9a7a1e9791120c2
Log:
fix conditions
Changed paths:
M ext/standard/image.c
Diff:
diff --git a/ext/standard/image.c b/ext/standard/image.c
index b2b5dcd..df76752 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;
}