summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchana Polampalli <archana.polampalli@windriver.com>2025-09-05 11:10:45 +0530
committerSteve Sakoman <steve@sakoman.com>2025-09-12 09:24:24 -0700
commit4f27d5ff829dbec6128cdb187ca76e621da13454 (patch)
tree482d0a119bd994bb89bb052c53ff25b571bf31f5
parente9b1bb75ffed3870c37aa83108f2dc5eb9f1894c (diff)
downloadpoky-4f27d5ff829dbec6128cdb187ca76e621da13454.tar.gz
ffmpeg: fix CVE-2025-1594
A vulnerability, which was classified as critical, was found in FFmpeg up to 7.1. This affects the function ff_aac_search_for_tns of the file libavcodec/aacenc_tns.c of the component AAC Encoder. The manipulation leads to stack-based buffer overflow. It is possible to initiate the attack remotely. The exploit has been disclosed to the public and may be used. (From OE-Core rev: 5a922eb95da7d373ee2bc3018065448fa128e69a) Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2025-1594.patch104
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.3.bb1
2 files changed, 105 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2025-1594.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2025-1594.patch
new file mode 100644
index 0000000000..b8f0bc5781
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2025-1594.patch
@@ -0,0 +1,104 @@
1From bedfb6eca402037f5cbb115fa767d106b8c14f1c Mon Sep 17 00:00:00 2001
2From: Lynne <dev@lynne.ee>
3Date: Sat, 8 Feb 2025 04:35:31 +0100
4Subject: [PATCH] aacenc_tns: clamp filter direction energy measurement
5
6The issue is that:
7
8float en[2];
9...
10tns->n_filt[w] = is8 ? 1 : order != TNS_MAX_ORDER ? 2 : 3;
11for (g = 0; g < tns->n_filt[w]; g++) {
12 tns->direction[w][g] = slant != 2 ? slant : en[g] < en[!g];
13
14When using the AAC Main profile, n_filt = 3, and slant is by
15default 2 (normal long frames), g can go above 1.
16
17en is the evolution of energy in the frequency domain for every
18band at the given window. E.g. whether the energy is concentrated
19at the top of each band, or the bottom.
20
21For 2-pole filters, its straightforward.
22For 3-pole filters, we need more than 2 measurements.
23
24This commit properly implements support for 3-pole filters, by measuring
25the band energy across three areas.
26
27Do note that even xHE-AAC caps n_filt to 2, and only AAC Main allows
28n_filt == 3.
29
30Fixes https://trac.ffmpeg.org/ticket/11418
31
32CVE: CVE-2025-1594
33
34Upstream-Status: Backport [https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/bedfb6eca402037f5cbb115fa767d106b8c14f1c]
35
36Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
37---
38 libavcodec/aacenc_tns.c | 33 ++++++++++++++++++++++++---------
39 1 file changed, 24 insertions(+), 9 deletions(-)
40
41diff --git a/libavcodec/aacenc_tns.c b/libavcodec/aacenc_tns.c
42index 8dc6dfc..9ea3506 100644
43--- a/libavcodec/aacenc_tns.c
44+++ b/libavcodec/aacenc_tns.c
45@@ -172,6 +172,7 @@ void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
46 sce->ics.window_sequence[0] == LONG_START_SEQUENCE ? 0 : 2;
47 const int sfb_len = sfb_end - sfb_start;
48 const int coef_len = sce->ics.swb_offset[sfb_end] - sce->ics.swb_offset[sfb_start];
49+ const int n_filt = is8 ? 1 : order != TNS_MAX_ORDER ? 2 : 3;
50
51 if (coef_len <= 0 || sfb_len <= 0) {
52 sce->tns.present = 0;
53@@ -179,16 +180,30 @@ void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
54 }
55
56 for (w = 0; w < sce->ics.num_windows; w++) {
57- float en[2] = {0.0f, 0.0f};
58+ float en[4] = {0.0f, 0.0f, 0.0f, 0.0f};
59 int oc_start = 0, os_start = 0;
60 int coef_start = sce->ics.swb_offset[sfb_start];
61
62- for (g = sfb_start; g < sce->ics.num_swb && g <= sfb_end; g++) {
63- FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[w*16+g];
64- if (g > sfb_start + (sfb_len/2))
65- en[1] += band->energy;
66- else
67- en[0] += band->energy;
68+ if (n_filt == 2) {
69+ for (g = sfb_start; g < sce->ics.num_swb && g <= sfb_end; g++) {
70+ FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[w*16+g];
71+ if (g > sfb_start + (sfb_len/2))
72+ en[1] += band->energy; /* End */
73+ else
74+ en[0] += band->energy; /* Start */
75+ }
76+ en[2] = en[0];
77+ } else {
78+ for (g = sfb_start; g < sce->ics.num_swb && g <= sfb_end; g++) {
79+ FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[w*16+g];
80+ if (g > sfb_start + (sfb_len/2) + (sfb_len/4))
81+ en[2] += band->energy; /* End */
82+ else if (g > sfb_start + (sfb_len/2) - (sfb_len/4))
83+ en[1] += band->energy; /* Middle */
84+ else
85+ en[0] += band->energy; /* Start */
86+ }
87+ en[3] = en[0];
88 }
89
90 /* LPC */
91@@ -198,9 +213,9 @@ void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
92 if (!order || !isfinite(gain) || gain < TNS_GAIN_THRESHOLD_LOW || gain > TNS_GAIN_THRESHOLD_HIGH)
93 continue;
94
95- tns->n_filt[w] = is8 ? 1 : order != TNS_MAX_ORDER ? 2 : 3;
96+ tns->n_filt[w] = n_filt;
97 for (g = 0; g < tns->n_filt[w]; g++) {
98- tns->direction[w][g] = slant != 2 ? slant : en[g] < en[!g];
99+ tns->direction[w][g] = slant != 2 ? slant : en[g] < en[g + 1];
100 tns->order[w][g] = g < tns->n_filt[w] ? order/tns->n_filt[w] : order - oc_start;
101 tns->length[w][g] = g < tns->n_filt[w] ? sfb_len/tns->n_filt[w] : sfb_len - os_start;
102 quantize_coefs(&coefs[oc_start], tns->coef_idx[w][g], tns->coef[w][g],
103--
1042.40.0
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.3.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.3.bb
index 27a9a80e8c..a46cb3480a 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.3.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.3.bb
@@ -52,6 +52,7 @@ SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
52 file://CVE-2023-6602-CVE-2023-6604-CVE-2023-6605-0001.patch \ 52 file://CVE-2023-6602-CVE-2023-6604-CVE-2023-6605-0001.patch \
53 file://CVE-2023-6602-CVE-2023-6604-CVE-2023-6605-0002.patch \ 53 file://CVE-2023-6602-CVE-2023-6604-CVE-2023-6605-0002.patch \
54 file://CVE-2023-6602-CVE-2023-6604-CVE-2023-6605-0003.patch \ 54 file://CVE-2023-6602-CVE-2023-6604-CVE-2023-6605-0003.patch \
55 file://CVE-2025-1594.patch \
55 " 56 "
56 57
57SRC_URI[sha256sum] = "04c70c377de233a4b217c2fdf76b19aeb225a287daeb2348bccd978c47b1a1db" 58SRC_URI[sha256sum] = "04c70c377de233a4b217c2fdf76b19aeb225a287daeb2348bccd978c47b1a1db"