commit | 1dd4e86283423fc6cd24c1f230e409718a21ed37 | [log] [tgz] |
---|---|---|
author | Wan-Teh Chang <wtc@google.com> | Mon Oct 12 16:52:50 2020 -0700 |
committer | Joe Drago <joedrago@gmail.com> | Wed Oct 14 11:33:38 2020 -0700 |
tree | 70c9f957d8e055dbea3b9640ef9ba94bc42b75c9 | |
parent | 31c7c1a27b03c72436e5d657bbe0fea2e635671d [diff] |
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; } }