summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchana Polampalli <archana.polampalli@windriver.com>2025-08-21 12:20:43 +0530
committerSteve Sakoman <steve@sakoman.com>2025-09-01 08:30:56 -0700
commitf584b357c3b4bd8cc48668caece670c1b929c8ce (patch)
treea19dae293a34dadf314dcf7f7db01e705e557e2e
parentc1b0ad70b4898ebc897ed1306e280c9ce924ec02 (diff)
downloadpoky-f584b357c3b4bd8cc48668caece670c1b929c8ce.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: c9a15206bae7f1e85dc3b8812eabb936a7e6d383) 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.patch105
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.3.bb1
2 files changed, 106 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..af71055c02
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2025-1594.patch
@@ -0,0 +1,105 @@
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
105
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.3.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.3.bb
index c0112757f0..dbd0a3f270 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.3.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.3.bb
@@ -34,6 +34,7 @@ SRC_URI = " \
34 file://CVE-2024-35369.patch \ 34 file://CVE-2024-35369.patch \
35 file://CVE-2025-25473.patch \ 35 file://CVE-2025-25473.patch \
36 file://CVE-2025-22921.patch \ 36 file://CVE-2025-22921.patch \
37 file://CVE-2025-1594.patch \
37" 38"
38 39
39SRC_URI[sha256sum] = "bc5f1e4a4d283a6492354684ee1124129c52293bcfc6a9169193539fbece3487" 40SRC_URI[sha256sum] = "bc5f1e4a4d283a6492354684ee1124129c52293bcfc6a9169193539fbece3487"