diff --git a/src/codecs/source_buffer.cpp b/src/codecs/source_buffer.cpp index 1db2e6c2..3b455038 100644 --- a/src/codecs/source_buffer.cpp +++ b/src/codecs/source_buffer.cpp @@ -40,8 +40,9 @@ auto SourceBuffer::Refill(IStream* src) -> bool { } bool eof = false; AddBytes([&](cpp::span buf) -> size_t { - size_t bytes_read = src->Read(buf); - eof = bytes_read == 0; + ssize_t bytes_read = src->Read(buf); + // Treat read errors as EOF. + eof = bytes_read <= 0; return bytes_read; }); return eof;