Skip to contentSkip to conversation

package/faad2: add upstream security fixes

PATCH New Baruch Siach 3 participants 3 messages Jul 1, 2019 – Jul 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/faad2: add upstream security fixes

CVE-2018-20194: Stack buffer overflow on invalid input

CVE-2018-20362: Null pointer dereference when processing crafted AAC input

Add two more crash fixes from upstream.

---
 ...k-for-syntax-element-inconsistencies.patch | 64 +++++++++++++++++
 ...fadj-sanitize-frequency-band-borders.patch | 71 +++++++++++++++++++
 .../0003-Fix-a-couple-buffer-overflows.patch  | 50 +++++++++++++
 ...prevent-crash-on-SCE-followed-by-CPE.patch | 54 ++++++++++++++
 4 files changed, 239 insertions(+)
 create mode 100644 package/faad2/0001-syntax.c-check-for-syntax-element-inconsistencies.patch
 create mode 100644 package/faad2/0002-sbr_hfadj-sanitize-frequency-band-borders.patch
 create mode 100644 package/faad2/0003-Fix-a-couple-buffer-overflows.patch
 create mode 100644 package/faad2/0004-add-patch-to-prevent-crash-on-SCE-followed-by-CPE.patch
package/faad2/0001-syntax.c-check-for-syntax-element-inconsistencies.patch new file +64 -0
new file mode 100644
index 000000000000..de97dbbaf068
@@ -0,0 +1,64 @@
+From 466b01d504d7e45f1e9169ac90b3e34ab94aed14 Mon Sep 17 00:00:00 2001
+From: Hugo Lefeuvre <[email protected]>
+Date: Mon, 25 Feb 2019 10:49:03 +0100
+Subject: [PATCH] syntax.c: check for syntax element inconsistencies
+
+Implicit channel mapping reconfiguration is explicitely forbidden by
+ISO/IEC 13818-7:2006 (8.5.3.3). Decoders should be able to detect such
+files and reject them. FAAD2 does not perform any kind of checks
+regarding this.
+
+This leads to security vulnerabilities when processing crafted AAC
+files performing such reconfigurations.
+
+Add checks to decode_sce_lfe and decode_cpe to make sure such
+inconsistencies are detected as early as possible.
+
+These checks first read hDecoder->frame: if this is not the first
+frame then we make sure that the syntax element at the same position
+in the previous frame also had element_id id_syn_ele. If not, return
+21 as this is a fatal file structure issue.
+
+This patch addresses CVE-2018-20362 (fixes #26) and possibly other
+related issues.
+
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Upstream status: commit 466b01d504d7
+
+ libfaad/syntax.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/libfaad/syntax.c b/libfaad/syntax.c
+index f8e808c269c0..e7fb11381e46 100644
+--- a/libfaad/syntax.c
++++ b/libfaad/syntax.c
+@@ -344,6 +344,12 @@ static void decode_sce_lfe(NeAACDecStruct *hDecoder,
+        can become 2 when some form of Parametric Stereo coding is used
+     */
+ 
++    if (hDecoder->frame && hDecoder->element_id[hDecoder->fr_ch_ele] != id_syn_ele) {
++        /* element inconsistency */
++        hInfo->error = 21;
++        return;
++    }
++
+     /* save the syntax element id */
+     hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+ 
+@@ -395,6 +401,12 @@ static void decode_cpe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfi
+         return;
+     }
+ 
++    if (hDecoder->frame && hDecoder->element_id[hDecoder->fr_ch_ele] != id_syn_ele) {
++        /* element inconsistency */
++        hInfo->error = 21;
++        return;
++    }
++
+     /* save the syntax element id */
+     hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+ 
+-- 
+2.20.1
+
package/faad2/0002-sbr_hfadj-sanitize-frequency-band-borders.patch new file +71 -0

71 lines not on this page · raw message

package/faad2/0003-Fix-a-couple-buffer-overflows.patch new file +50 -0

50 lines not on this page · raw message

package/faad2/0004-add-patch-to-prevent-crash-on-SCE-followed-by-CPE.patch new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/faad2: add upstream security fixes

Quoted 8 lines · Baruch Siach

CVE-2018-20194: Stack buffer overflow on invalid input

CVE-2018-20362: Null pointer dereference when processing crafted AAC input

Add two more crash fixes from upstream.

Applied to master, thanks.

Regards,
Arnout

#2 lore raw

PATCH 1/1 package/faad2: add upstream security fixes

In reply to Baruch Siach
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

CVE-2018-20194: Stack buffer overflow on invalid input
CVE-2018-20362: Null pointer dereference when processing crafted AAC input

Add two more crash fixes from upstream.

Committed to 2019.02.x and 2019.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard