From 93bb98d440b91aaace2d6346d8870cc5c46ab970 Mon Sep 17 00:00:00 2001 From: Victor Goya Date: Tue, 4 Jun 2013 17:19:28 +0200 Subject: [PATCH] loadJPEG: fix fread() return value testing According to the fread() manpage, successful fread() call will return 1 and not len in this case. --- src/Image.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Image.cc b/src/Image.cc index 6938884..90cd2c2 100644 --- a/src/Image.cc +++ b/src/Image.cc @@ -1,4 +1,3 @@ - // // Image.cc // @@ -889,7 +888,7 @@ Image::loadJPEG(FILE *stream) { buf = (uint8_t *) malloc(len); if (!buf) return CAIRO_STATUS_NO_MEMORY; - if (fread(buf, len, 1, stream) != len) { + if (fread(buf, len, 1, stream) != 1) { status = CAIRO_STATUS_READ_ERROR; } else if ((DATA_IMAGE | DATA_MIME) == data_mode) { status = loadJPEGFromBuffer(buf, len);