This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 9bc73ba3449ff91e760b8c4e0a5d2bbc953ab9ac
Author:     Niklas Haas <[email protected]>
AuthorDate: Sat Jul 11 13:03:24 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sun Jul 19 10:20:04 2026 +0000

    avformat/shared: treat unexpected EOF as corruption
    
    This can happen if e.g. the file is truncated (e.g. by a filesystem bug
    or self-healing response to an underlying checksum mismatch), in which case
    we should treat it similar as a corruption case and retry it under
    -retry_corrupt.
    
    Sponsored-by: nxtedition AB
    Signed-off-by: Niklas Haas <[email protected]>
---
 libavformat/shared.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/shared.c b/libavformat/shared.c
index df72abff7f..87278f1288 100644
--- a/libavformat/shared.c
+++ b/libavformat/shared.c
@@ -547,7 +547,7 @@ static int read_cache(SharedContext *s, uint8_t *buf, 
size_t size, off_t offset)
     while (size) {
         ssize_t ret = pread(s->fd, buf, size, offset);
         if (ret <= 0)
-            return ret ? AVERROR(errno) : AVERROR(EIO);
+            return ret ? AVERROR(errno) : AVERROR_EOF;
         buf    += ret;
         offset += ret;
         size   -= ret;
@@ -630,6 +630,13 @@ retry:
             ret = read_cache(s, tmp, block_size, block_pos);
             if (ret < 0) {
                 av_log(h, AV_LOG_ERROR, "Failed to read from cache file: 
%s\n", av_err2str(ret));
+                if (ret == AVERROR_EOF) { /* e.g. cache appears truncated? */
+                    if (s->retry_corrupt) {
+                        s->num_corrupt++;
+                        goto read_block;
+                    }
+                    ret = AVERROR(EIO); /* don't propagate EOF to caller */
+                }
                 return ret;
             }
         }

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to