diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_bytes_io_wrap.h b/Telegram/SourceFiles/ffmpeg/ffmpeg_bytes_io_wrap.h index 3899325f0566b8..b7387ba97a6621 100644 --- a/Telegram/SourceFiles/ffmpeg/ffmpeg_bytes_io_wrap.h +++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_bytes_io_wrap.h @@ -21,7 +21,9 @@ struct ReadBytesWrap { const auto toRead = std::min( int64(buf_size), wrap->size - wrap->offset); - if (toRead > 0) { + if (!toRead) { + return AVERROR_EOF; + } else if (toRead > 0) { memcpy(buf, wrap->data + wrap->offset, toRead); wrap->offset += toRead; }