]> granicus.if.org Git - php/commitdiff
fix conditions
authorAnatol Belski <ab@php.net>
Fri, 19 Sep 2014 07:49:32 +0000 (09:49 +0200)
committerAnatol Belski <ab@php.net>
Fri, 19 Sep 2014 07:49:32 +0000 (09:49 +0200)
ext/standard/image.c

index b2b5dcd3697df0af802c358618f0977f1f14ce97..df767528a91ade0b9ef0ba5fe7228b6a0be04ec8 100644 (file)
@@ -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;
        }