Commit 5d20365bb4 for ffmpeg
commit 5d20365bb4e6d459c5ab479f82c5ac342b0c3479
Author: Niklas Haas <git@haasn.dev>
Date: Sun Oct 4 14:36:51 2026 +0200
avformat/jpegmpfenc: skip marker padding bytes
JPEG segments may be preceded by an arbitrary number of 0xFF bytes.
We don't need a separate length check here because the bytestream2 API
already returns 0 when the end of the segment is reached prematurely, which
would fail the following length check.
Signed-off-by: Niklas Haas <git@haasn.dev>
diff --git a/libavformat/jpegmpfenc.c b/libavformat/jpegmpfenc.c
index 5f9e8145dd..84c24aa584 100644
--- a/libavformat/jpegmpfenc.c
+++ b/libavformat/jpegmpfenc.c
@@ -264,6 +264,8 @@ static int mpf_write_packet(AVFormatContext *ctx, AVPacket *pkt)
}
int marker = bytestream2_get_byte(&gb);
+ while (marker == 0xFF) /* fill bytes */
+ marker = bytestream2_get_byte(&gb);
if (marker == SOS || marker == TEM || (marker >= RST0 && marker <= EOI)) {
if (!img->splice_pos)
img->splice_pos = pos;