summaryrefslogtreecommitdiff
path: root/ext/gd/gd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/gd.c')
-rw-r--r--ext/gd/gd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 92adaedf94..fd4a8401c3 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1443,11 +1443,11 @@ PHP_FUNCTION(imageloadfont)
*/
font = (gdFontPtr) emalloc(sizeof(gdFont));
b = 0;
- while (b < hdr_size && (n = php_stream_read(stream, (char*)&font[b], hdr_size - b))) {
+ while (b < hdr_size && (n = php_stream_read(stream, (char*)&font[b], hdr_size - b)) > 0) {
b += n;
}
- if (!n) {
+ if (n <= 0) {
efree(font);
if (php_stream_eof(stream)) {
php_error_docref(NULL, E_WARNING, "End of file while reading header");
@@ -1486,11 +1486,11 @@ PHP_FUNCTION(imageloadfont)
font->data = emalloc(body_size);
b = 0;
- while (b < body_size && (n = php_stream_read(stream, &font->data[b], body_size - b))) {
+ while (b < body_size && (n = php_stream_read(stream, &font->data[b], body_size - b)) > 0) {
b += n;
}
- if (!n) {
+ if (n <= 0) {
efree(font->data);
efree(font);
if (php_stream_eof(stream)) {