summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-multimedia/libmad/libmad/CVE-2017-8372_CVE-2017-8373.patch69
-rw-r--r--meta-oe/recipes-multimedia/libmad/libmad_0.15.1b.bb1
2 files changed, 70 insertions, 0 deletions
diff --git a/meta-oe/recipes-multimedia/libmad/libmad/CVE-2017-8372_CVE-2017-8373.patch b/meta-oe/recipes-multimedia/libmad/libmad/CVE-2017-8372_CVE-2017-8373.patch
new file mode 100644
index 0000000000..a57df492d0
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libmad/libmad/CVE-2017-8372_CVE-2017-8373.patch
@@ -0,0 +1,69 @@
1From 7e8f6e5118e31455924940141a761a1589e8d85d Mon Sep 17 00:00:00 2001
2From: Kurt Roeckx <kurt@roeckx.be>
3Date: Sun, 28 Jan 2018 15:44:08 +0100
4Subject: [PATCH] Check the size of the main data
5
6The main data to decode a frame can come from the current frame and part of the
7previous frame, the so called bit reservoir. si.main_data_begin is the part of
8the previous frame we need for this frame. frame_space is the amount of main
9data that can be in this frame, and next_md_begin is the part of this frame that
10is going to be used for the next frame.
11
12The maximum amount of data from a previous frame that the format allows is 511
13bytes. The maximum frame size for the defined bitrates is at MPEG 2.5 layer 2
14at 320 kbit/s and 8 kHz sample rate which gives 72 * (320000 / 8000) + 1 = 2881.
15So those defines are not large enough:
16 # define MAD_BUFFER_GUARD 8
17 # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
18
19There is also support for a "free" bitrate which allows you to create any frame
20size, which can be larger than the buffer.
21
22Changing the defines is not an option since it's part of the ABI, so we check
23that the main data fits in the bufer.
24
25The previous frame data is stored in *stream->main_data and contains
26stream->md_len bytes. If stream->md_len is larger than the data we
27need from the previous frame (si.main_data_begin) it still wouldn't fit
28in the buffer, so just keep the data that we need.
29
30Source: https://salsa.debian.org/multimedia-team/libmad/-/blob/debian/0.15.1b-11/debian/patches/md_size.diff?ref_type=tags
31
32CVE: CVE-2017-8372
33CVE: CVE-2017-8373
34Upstream-Status: Inactive-Upstream [lastrelease: 2018]
35Signed-off-by: Peter Marko <peter.marko@siemens.com>
36---
37 layer3.c | 12 ++++++++++--
38 1 file changed, 10 insertions(+), 2 deletions(-)
39
40diff --git a/layer3.c b/layer3.c
41index 4e5d3fa..7dc4ca6 100644
42--- a/layer3.c
43+++ b/layer3.c
44@@ -2608,6 +2608,11 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame)
45 next_md_begin = 0;
46
47 md_len = si.main_data_begin + frame_space - next_md_begin;
48+ if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN) {
49+ stream->error = MAD_ERROR_LOSTSYNC;
50+ stream->sync = 0;
51+ return -1;
52+ }
53
54 frame_used = 0;
55
56@@ -2625,8 +2630,11 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame)
57 }
58 }
59 else {
60- mad_bit_init(&ptr,
61- *stream->main_data + stream->md_len - si.main_data_begin);
62+ memmove(stream->main_data,
63+ *stream->main_data + stream->md_len - si.main_data_begin,
64+ si.main_data_begin);
65+ stream->md_len = si.main_data_begin;
66+ mad_bit_init(&ptr, *stream->main_data);
67
68 if (md_len > si.main_data_begin) {
69 assert(stream->md_len + md_len -
diff --git a/meta-oe/recipes-multimedia/libmad/libmad_0.15.1b.bb b/meta-oe/recipes-multimedia/libmad/libmad_0.15.1b.bb
index 2d63f9a804..b6668980da 100644
--- a/meta-oe/recipes-multimedia/libmad/libmad_0.15.1b.bb
+++ b/meta-oe/recipes-multimedia/libmad/libmad_0.15.1b.bb
@@ -16,6 +16,7 @@ SRC_URI = "https://downloads.sourceforge.net/mad/libmad-${PV}.tar.gz \
16 file://obsolete_automake_macros.patch \ 16 file://obsolete_automake_macros.patch \
17 file://automake-foreign.patch \ 17 file://automake-foreign.patch \
18 file://0001-configure-Respect-the-cflags-from-environment.patch \ 18 file://0001-configure-Respect-the-cflags-from-environment.patch \
19 file://CVE-2017-8372_CVE-2017-8373.patch \
19" 20"
20SRC_URI:append:toolchain-clang = " file://0004-Remove-clang-unsupported-compiler-flags.patch " 21SRC_URI:append:toolchain-clang = " file://0004-Remove-clang-unsupported-compiler-flags.patch "
21 22