diff mbox series

[scarthgap,22/37] ffmpeg: Fix CVE-2026-40962

Message ID 40f53d038fce9297f7ca0153ee44ccd9c3d1b7f5.1795798718.git.yoann.congal@smile.fr
State RFC, archived
Delegated to: Yoann Congal
Headers show
Series [scarthgap,01/37] bison: fix CVE-2026-56390 | expand

Commit Message

Yoann Congal Nov. 27, 2026, 5:49 p.m. UTC
From: Colin Pinnell McAllister <colin.mcallister@garmin.com>

Backports patch for CVE-2026-40962 to ffmpeg 6.1.4.

Signed-off-by: Colin Pinnell McAllister <colin.mcallister@garmin.com>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 .../ffmpeg/ffmpeg/CVE-2026-40962.patch        | 61 +++++++++++++++++++
 .../recipes-multimedia/ffmpeg/ffmpeg_6.1.4.bb |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2026-40962.patch
diff mbox series

Patch

diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2026-40962.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2026-40962.patch
new file mode 100644
index 00000000000..608dc638ed3
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2026-40962.patch
@@ -0,0 +1,61 @@ 
+From 5d272b8c9541fa082dfb064e7e5847de4c4300ba Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michael@niedermayer.cc>
+Date: Tue, 24 Feb 2026 03:47:15 +0100
+Subject: [PATCH] avformat/mov: use 64bit in CENC subsample bounds checks
+
+Found-by: Quang Luong <oss@engineer.ink>
+Found-by: PrymEvol
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+(cherry picked from commit e392fb8c9c3949d975531d2b23c645d2465a7ebc)
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2026-40962
+Upstream-Status: Backport [https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/78c944bdb170d8dcece166115d92b45379b040f4]
+Signed-off-by: Colin Pinnell McAllister <colin.mcallister@garmin.com>
+---
+ libavformat/mov.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/libavformat/mov.c b/libavformat/mov.c
+index 7a7545c9b5..af103ad24d 100644
+--- a/libavformat/mov.c
++++ b/libavformat/mov.c
+@@ -7178,7 +7178,7 @@ static int cenc_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryption
+     }
+ 
+     for (i = 0; i < sample->subsample_count; i++) {
+-        if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
++        if (sample->subsamples[i].bytes_of_clear_data + (int64_t)sample->subsamples[i].bytes_of_protected_data > size) {
+             av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
+             return AVERROR_INVALIDDATA;
+         }
+@@ -7233,7 +7233,7 @@ static int cbc1_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryption
+     }
+ 
+     for (i = 0; i < sample->subsample_count; i++) {
+-        if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
++        if (sample->subsamples[i].bytes_of_clear_data + (int64_t)sample->subsamples[i].bytes_of_protected_data > size) {
+             av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
+             return AVERROR_INVALIDDATA;
+         }
+@@ -7295,7 +7295,7 @@ static int cens_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryption
+     }
+ 
+     for (i = 0; i < sample->subsample_count; i++) {
+-        if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
++        if (sample->subsamples[i].bytes_of_clear_data + (int64_t)sample->subsamples[i].bytes_of_protected_data > size) {
+             av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
+             return AVERROR_INVALIDDATA;
+         }
+@@ -7360,7 +7360,7 @@ static int cbcs_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryption
+     }
+ 
+     for (i = 0; i < sample->subsample_count; i++) {
+-        if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
++        if (sample->subsamples[i].bytes_of_clear_data + (int64_t)sample->subsamples[i].bytes_of_protected_data > size) {
+             av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
+             return AVERROR_INVALIDDATA;
+         }
+-- 
+2.56.1
+
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.4.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.4.bb
index 849835c8493..44ad063e690 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.4.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.4.bb
@@ -32,6 +32,7 @@  SRC_URI = " \
     file://CVE-2024-35369.patch \
     file://CVE-2025-25473.patch \
     file://CVE-2025-22921.patch \
+    file://CVE-2026-40962.patch \
 "
 
 SRC_URI[sha256sum] = "a231e3d5742c44b1cdaebfb98ad7b6200d12763e0b6db9e1e2c5891f2c083a18"