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

Git pushed a commit to branch master
in repository ffmpeg.

commit dec1ffb86d8aa0bad663308fe129253287fba259
Author:     Niklas Haas <[email protected]>
AuthorDate: Tue Aug 11 17:30:21 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Mon Aug 31 10:56:08 2026 +0000

    avcodec/j2kenc: fix edge case when packet ends on 0xFF
    
    ISO/IEC 15444-1:2002 (E), Annex B.10.1 "Bit-stuffing routine":
    
    > The last byte in the packet header shall not be an 0xFF value (thus the
    > single zero bit stuffed after a byte with 0xFF must be included even if
    > the 0xFF would otherwise have been the last byte).
    
    This matches the behavior seen in the jpeg2000 decoder (jpeg2000_flush),
    and the behavior of openjpeg.
    
    Sponsored-by: nxtedition AB
    Signed-off-by: Niklas Haas <[email protected]>
---
 libavcodec/j2kenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index ac18c66b99..295de71169 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -176,6 +176,8 @@ static void j2k_flush(Jpeg2000EncoderContext *s)
 {
     if (s->bit_index){
         s->bit_index = 0;
+        if (*s->buf == 0xff)
+            *(++s->buf) = 0;
         s->buf++;
     }
 }

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