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

Git pushed a commit to branch master
in repository ffmpeg.

commit 574c34228cb1bb8e4aaec3f2d9ffaa90aad2e06f
Author:     Lynne <[email protected]>
AuthorDate: Wed Sep 23 20:27:15 2026 +0900
Commit:     James Almer <[email protected]>
CommitDate: Fri Sep 25 02:13:39 2026 +0000

    avcodec/opus/rc: zero the unused bytes of an encoded frame
    
    When the range coded data and the raw bits of a frame did not meet, the
    bytes between them were copied from the stale contents of the range
    coder buffer, and when there were no raw bits, the bytes after the range
    coded data were left as whatever the packet buffer held. Zero them
    instead, like libopus does.
---
 libavcodec/opus/rc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/opus/rc.c b/libavcodec/opus/rc.c
index 8e58a52b85..57ac272934 100644
--- a/libavcodec/opus/rc.c
+++ b/libavcodec/opus/rc.c
@@ -393,9 +393,17 @@ void ff_opus_rc_enc_end(OpusRangeCoder *rc, uint8_t *dst, 
int size)
         rb_src = rc->buf + OPUS_MAX_FRAME_SIZE + 12 - rc->rb.bytes;
         rb_dst = dst + FFMAX(size - rc->rb.bytes, 0);
         lap = &dst[rng_bytes] - rb_dst;
+        if (lap < 0) {
+            /* Zero the unused bytes between the range coded and the raw bits
+             * parts instead of copying whatever is in the buffer there */
+            memset(&dst[rng_bytes], 0, -lap);
+            lap = 0;
+        }
         for (i = 0; i < lap; i++)
             rb_dst[i] |= rb_src[i];
         memcpy(&rb_dst[lap], &rb_src[lap], FFMAX(rc->rb.bytes - lap, 0));
+    } else if (rng_bytes < size) {
+        memset(&dst[rng_bytes], 0, size - rng_bytes);
     }
 }
 

-- 
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