Detect file read error by calling ferror()

If fread() returns a byte count less than 'size', distinguish between
the error and end-of-file conditions by calling ferror().
diff --git a/src/io.c b/src/io.c
index 341f29d..29f3008 100644
--- a/src/io.c
+++ b/src/io.c
@@ -110,6 +110,9 @@
         }
         size_t bytesRead = fread(reader->buffer.data, 1, size, reader->f);
         if (size != bytesRead) {
+            if (ferror(reader->f)) {
+                return AVIF_RESULT_IO_ERROR;
+            }
             size = bytesRead;
         }
     }