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

Git pushed a commit to branch master
in repository ffmpeg.

commit d353ea87b74abb48adbb0715927d401d8828f918
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Thu Oct 15 04:34:32 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Mon Oct 19 23:51:00 2026 +0000

    avformat/sctp: return AVERROR_EOF when the peer closes the association
    
    Fixes: WoBBcuySgSTx
    Fixes: 
swarm-sctp_read-returns-2-on-graceful-close-never-signalling-EOF-2a7ba0
    Endless loop Replicated through UnModified FFmpeg
    
    Found-by: zhang xingxing <[email protected]>
    The report suggested not adding the stream id size when recvmsg() returns 0.
    The case without max_streams was found during triage of the report.
    
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/sctp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/sctp.c b/libavformat/sctp.c
index 0efac12d96..ed132f1851 100644
--- a/libavformat/sctp.c
+++ b/libavformat/sctp.c
@@ -309,17 +309,19 @@ static int sctp_read(URLContext *h, uint8_t *buf, int 
size)
     }
 
     if (s->max_streams) {
-        if (size < 2)
+        if (size <= 2)
             return AVERROR(EINVAL);
 
         /*StreamId is introduced as a 2byte code into the stream*/
         struct sctp_sndrcvinfo info = { 0 };
         ret = ff_sctp_recvmsg(s->fd, buf + 2, size - 2, NULL, 0, &info, 0);
         AV_WB16(buf, info.sinfo_stream);
-        ret = ret < 0 ? ret : ret + 2;
+        ret = ret <= 0 ? ret : ret + 2;
     } else
         ret = recv(s->fd, buf, size, 0);
 
+    if (!ret)
+        return AVERROR_EOF;
     return ret < 0 ? ff_neterrno() : ret;
 }
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to