]> granicus.if.org Git - php/commitdiff
Fix tautological compare warning
authorDavid Carlier <devnexen@gmail.com>
Fri, 13 Sep 2019 10:37:53 +0000 (11:37 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 13 Sep 2019 22:25:00 +0000 (00:25 +0200)
The ZEND_ALLOCATOR() macro compares against constants that are
larger than the unsigned short type, resulting in warnings on
clang. Avoid this by explicitly casting to size_t.

ext/standard/image.c

index 53c42a0e51066c47348966810486a64b15f3c7eb..aaaf81ae9e48949db2071298dd10b0e85211a9b0 100644 (file)
@@ -449,9 +449,9 @@ static int php_read_APP(php_stream * stream, unsigned int marker, zval *info)
        }
        length -= 2;                            /* length includes itself */
 
-       buffer = emalloc(length);
+       buffer = emalloc((size_t)length);
 
-       if (php_stream_read(stream, buffer, (zend_long) length) != length) {
+       if (php_stream_read(stream, buffer, (size_t) length) != length) {
                efree(buffer);
                return 0;
        }