PR #25964 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25964
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25964.patch


>From 96497daddb36c82c442021d3399eea4c25502c59 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 18:51:39 +0100
Subject: [PATCH 01/10] avcodec/iff: clear the mask palette table

Fixes: use of uninitialized memory
Fixes: dLFZWeypJpSK
Fixes: ilbm-mask-short-cmap.ilbm
Use of uninitialized memory Replicated through UnModified FFmpeg with MSAN

Found-by: zx (Jace)
---
 libavcodec/iff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 66839c3c393..169cda28e0d 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -254,7 +254,7 @@ static int extract_header(AVCodecContext *const avctx,
             s->mask_buf = av_malloc((s->planesize * 32) + 
AV_INPUT_BUFFER_PADDING_SIZE);
             if (!s->mask_buf)
                 return AVERROR(ENOMEM);
-            s->mask_palbuf = av_malloc((2 << s->bpp) * sizeof(uint32_t) + 
AV_INPUT_BUFFER_PADDING_SIZE);
+            s->mask_palbuf = av_mallocz((2 << s->bpp) * sizeof(uint32_t) + 
AV_INPUT_BUFFER_PADDING_SIZE);
             if (!s->mask_palbuf)
                 return AVERROR(ENOMEM);
         }
-- 
2.54.0


>From c1cf5c4c8399886af2d096ff84726b51a9d59f7b Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 18:52:51 +0100
Subject: [PATCH 02/10] avcodec/iff: clear the HAM palette table

Fixes: use of uninitialized memory
Fixes: zPQwovKkiM2r
Fixes: pbm-ham4-pixel-ff.iff
Use of uninitialized memory Replicated through UnModified FFmpeg with MSAN

Found during triage of the security report dLFZWeypJpSK
---
 libavcodec/iff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 169cda28e0d..329a2d9ce39 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -284,7 +284,7 @@ static int extract_header(AVCodecContext *const avctx,
             return AVERROR(ENOMEM);
 
         ham_count = 8 * (1 << s->ham);
-        s->ham_palbuf = av_malloc(extra_space * (ham_count << !!(s->masking == 
MASK_HAS_MASK)) * sizeof (uint32_t) + AV_INPUT_BUFFER_PADDING_SIZE);
+        s->ham_palbuf = av_mallocz(extra_space * (ham_count << !!(s->masking 
== MASK_HAS_MASK)) * sizeof (uint32_t) + AV_INPUT_BUFFER_PADDING_SIZE);
         if (!s->ham_palbuf)
             return AVERROR(ENOMEM);
 
-- 
2.54.0


>From d5bb1a932d66b5e7395c5ab5f723b65095feabd2 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 18:53:22 +0100
Subject: [PATCH 03/10] avcodec/iff: allocate the plane buffer zeroed

Fixes: use of uninitialized memory
Fixes: FPOEGUObScuK
Fixes: ilbm-vdat-missing.iff
Use of uninitialized memory Replicated through UnModified FFmpeg with MSAN

Found during triage of the security report dLFZWeypJpSK
---
 libavcodec/iff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 329a2d9ce39..71cc8b3c33d 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -371,7 +371,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     if ((err = av_image_check_size(avctx->width, avctx->height, 0, avctx)))
         return err;
     s->planesize = FFALIGN(avctx->width, 16) >> 3; // Align plane size in bits 
to word-boundary
-    s->planebuf  = av_malloc(s->planesize * avctx->height + 
AV_INPUT_BUFFER_PADDING_SIZE);
+    s->planebuf  = av_mallocz(s->planesize * avctx->height + 
AV_INPUT_BUFFER_PADDING_SIZE);
     if (!s->planebuf)
         return AVERROR(ENOMEM);
 
-- 
2.54.0


>From 31b9adb37f0f605b193d6e1f8991882f9e288994 Mon Sep 17 00:00:00 2001
From: Sakib Sarkar <[email protected]>
Date: Wed, 11 Nov 2026 19:09:26 +0100
Subject: [PATCH 04/10] avformat/mov: reject HEIF grids without coded
 dimensions

Fixes: infinite loop
Fixes: YgVX1m47At6V
Fixes: heif-grid-tile-without-ispe.heic
Infinite loop Replicated through UnModified FFmpeg with timeout

Found-by: Sakib Sarkar
---
 libavformat/mov.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0c2f592e7f3..ca33cb2285b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -11270,6 +11270,8 @@ static int read_image_grid(AVFormatContext *s, const 
HEIFGroup *grid,
 
     if (coded_width > INT_MAX || coded_height > INT_MAX)
         return AVERROR_INVALIDDATA;
+    if (coded_width == 0 || coded_height == 0)
+        return AVERROR_INVALIDDATA;
 
     tile_grid->coded_width  = coded_width;
     tile_grid->coded_height = coded_height;
-- 
2.54.0


>From 4feeacdc4d0767e24a0ae278abcd0aded326dd5d Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 19:18:06 +0100
Subject: [PATCH 05/10] avfilter/vf_lcevc: allocate the output frame for the
 picture LCEVCdec outputs

Fixes: out of array write
Fixes: MO1ctCOYehkw
Fixes: vf-lcevc-4x.ts
Out of array write Replicated through UnModified FFmpeg with ASAN

Found-by: betah4k
---
 libavfilter/vf_lcevc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavfilter/vf_lcevc.c b/libavfilter/vf_lcevc.c
index 01e5ded9006..6fe6edb61ff 100644
--- a/libavfilter/vf_lcevc.c
+++ b/libavfilter/vf_lcevc.c
@@ -354,6 +354,18 @@ static int activate(AVFilterContext *ctx)
             av_frame_free(&in);
             return ret;
         }
+
+        LCEVC_PictureDesc desc;
+        if (LCEVC_PeekDecoderPictureDesc(lcevc->decoder, in->pts, &desc) != 
LCEVC_Success ||
+            desc.colorFormat != map_format(outlink->format)) {
+            av_log(ctx, AV_LOG_ERROR, "Unsupported enhanced picture\n");
+            LCEVC_SkipDecoder(lcevc->decoder, in->pts);
+            LCEVC_SynchronizeDecoder(lcevc->decoder, 0);
+            flush_bases(ctx);
+            return AVERROR_EXTERNAL;
+        }
+        lcevc->w = desc.width;
+        lcevc->h = desc.height;
     }
 
     out = ff_get_video_buffer(outlink, lcevc->w, lcevc->h);
-- 
2.54.0


>From 655041a309b4e71c5afaa8f6cba29447a7ff7722 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 19:22:26 +0100
Subject: [PATCH 06/10] avformat/http: reuse a connection only for the host it
 is connected to

Fixes: sending credentials to another host
Fixes: q0uD8AyJRreA
Regression since: e03b034e45
Credential disclosure Replicated through UnModified FFmpeg with a local HTTP 
server

Found-by: mxyoor
---
 libavformat/http.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index a7854122f1b..546b591d0ce 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -343,6 +343,9 @@ static int http_open_cnx_internal(URLContext *h, 
AVDictionary **options)
 
     ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
 
+    if (s->hd && strcmp(s->hd->filename, buf))
+        ffurl_closep(&s->hd);
+
     if (!s->hd) {
         s->nb_connections++;
         err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE,
-- 
2.54.0


>From 46aa45e72e7f00d829e3ea80fe36edf6e927a9eb Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 19:25:26 +0100
Subject: [PATCH 07/10] avformat/http: reject control characters and spaces in
 the CONNECT target

Fixes: CRLF injection
Fixes: ZDI-CAN-35984
Fixes: iUFdqPjbigVZ
CRLF injection Replicated through UnModified FFmpeg with a local TCP listener

Found-by: Yves Bieri (@yves_bieri) of Xint (@xint_official) working with 
TrendAI Zero Day Initiative
---
 libavformat/http.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 546b591d0ce..3551680d98b 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -2562,6 +2562,9 @@ static int http_proxy_open(URLContext *h, const char 
*uri, int flags)
     path = pathbuf;
     if (*path == '/')
         path++;
+    for (const char *p = path; *p; p++)
+        if ((uint8_t)*p <= ' ' || *p == 0x7f)
+            return AVERROR(EINVAL);
 
     ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port,
                 NULL);
-- 
2.54.0


>From 857039a5215e72490ab5df3e2982001c7175ff0c Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 19:36:54 +0100
Subject: [PATCH 08/10] avformat/http: reject CR and LF in the hostname

Fixes: CRLF injection
Fixes: eiIHGT2jJznc
Fixes: proxy_host_crlf_poc.py
CRLF injection Replicated through UnModified FFmpeg with a local TCP listener

Found during triage of the security report iUFdqPjbigVZ (ZDI-CAN-35984)
---
 libavformat/http.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3551680d98b..2a4481da591 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -267,6 +267,8 @@ static int http_open_cnx_internal(URLContext *h, 
AVDictionary **options)
     av_url_split(proto, sizeof(proto), auth, sizeof(auth),
                  hostname, sizeof(hostname), &port,
                  path1, sizeof(path1), s->location);
+    if (strpbrk(hostname, "\r\n"))
+        return AVERROR(EINVAL);
 
     av_freep(&s->host);
     s->host = av_strdup(hostname);
-- 
2.54.0


>From 00a20a3e3fb6c8f895ec0e617a180686b1b43a16 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 19:38:10 +0100
Subject: [PATCH 09/10] avformat/httpauth: do not put CR or LF into the Digest
 header

Fixes: CRLF injection
Fixes: avx3Qkpk8ANg
Fixes: digest_username_crlf_poc.py
Fixes: proxy_digest_uri_crlf_poc.py
CRLF injection Replicated through UnModified FFmpeg with a local TCP listener

Found during triage of the security report iUFdqPjbigVZ (ZDI-CAN-35984)
---
 libavformat/httpauth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
index 276054a98ed..e9aeb95ec84 100644
--- a/libavformat/httpauth.c
+++ b/libavformat/httpauth.c
@@ -292,7 +292,8 @@ char *ff_http_auth_create_response(HTTPAuthState *state, 
const char *auth,
         if (!username)
             return NULL;
 
-        if ((password = strchr(username, ':'))) {
+        if ((password = strchr(username, ':')) &&
+            !strpbrk(username, "\r\n") && !strpbrk(path, "\r\n")) {
             *password++ = 0;
             authstr = make_digest_auth(state, username, password, path, 
method);
         }
-- 
2.54.0


>From dc54cd2d15a35dbab7bc350515d210b855b75e04 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 11 Nov 2026 19:38:11 +0100
Subject: [PATCH 10/10] avformat/rtsp: reject CR and LF in the request URL

Fixes: CRLF injection
Fixes: NyyjMIh7x39e
Fixes: rtsp_crlf_poc.py
CRLF injection Replicated through UnModified FFmpeg with a local TCP listener

Found during triage of the security report iUFdqPjbigVZ (ZDI-CAN-35984)
---
 libavformat/rtsp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 9bc389c4526..d455438fa56 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1481,6 +1481,8 @@ int ff_rtsp_send_cmd_with_content_async(AVFormatContext 
*s,
 
     if (!rt->rtsp_hd_out)
         return AVERROR(ENOTCONN);
+    if (strpbrk(url, "\r\n"))
+        return AVERROR(EINVAL);
 
     /* Add in RTSP headers */
     out_buf = buf;
-- 
2.54.0

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

Reply via email to