blob: f048c2e715505a871d1b57bc4e8257f8aa156255 [file] [log] [blame]
Patrick Williams213cb262021-08-07 19:21:33 -05001From 223b5e8ac9f6461bb13ed365419ec485c5b2b002 Mon Sep 17 00:00:00 2001
2From: Michael Niedermayer <michael@niedermayer.cc>
3Date: Fri, 28 May 2021 20:18:25 +0200
4Subject: [PATCH] avcodec/aacpsy: Avoid floating point division by 0 of
5 norm_fac
6
7Fixes: Ticket7995
8Fixes: CVE-2020-20446
9
10Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
11
12CVE: CVE-2020-20446
13Upstream-Status: Backport [223b5e8ac9f6461bb13ed365419ec485c5b2b002]
14
15Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
16---
17 libavcodec/aacpsy.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
21index 482113d427..e51d29750b 100644
22--- a/libavcodec/aacpsy.c
23+++ b/libavcodec/aacpsy.c
24@@ -794,7 +794,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
25
26 if (pe < 1.15f * desired_pe) {
27 /* 6.6.1.3.6 "Final threshold modification by linearization" */
28- norm_fac = 1.0f / norm_fac;
29+ norm_fac = norm_fac ? 1.0f / norm_fac : 0;
30 for (w = 0; w < wi->num_windows*16; w += 16) {
31 for (g = 0; g < num_bands; g++) {
32 AacPsyBand *band = &pch->band[w+g];
33--
342.32.0
35