Package: libsdl1.2 / 1.2.15+dfsg2-8

CVE-2019-7577-1_2.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From: =?utf-8?b?UGV0ciBQw61zYcWZ?= <ppisar@redhat.com>
Date: Mon, 10 Jun 2019 08:54:29 -0700
Subject: CVE-2019-7577: Fix a buffer overread in MS_ADPCM_nibble and
 MS_ADPCM_decode
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

If a chunk of RIFF/WAV file with MS ADPCM encoding contains an invalid
predictor (a valid predictor's value is between 0 and 6 inclusive),
a buffer overread can happen when the predictor is used as an index
into an array of MS ADPCM coefficients.

The overead happens when indexing MS_ADPCM_state.aCoeff[] array in
MS_ADPCM_decode() and later when dereferencing a coef pointer in
MS_ADPCM_nibble().

This patch fixes it by checking the MS ADPCM predictor values fit
into the valid range.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=4492
Bug-CVE: CVE-2019-7577
Signed-off-by: Petr Písař <ppisar@redhat.com>
Origin: upstream, commit:https://github.com/libsdl-org/SDL-1.2/commit/68f914a78ef09a4d2db43e0c7c2848a6b7c03655
---
 src/audio/SDL_wave.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
index 6c6eb14..3eedd20 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -147,6 +147,9 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
 		if ( stereo ) {
 			state[1]->hPredictor = *encoded++;
 		}
+		if (state[0]->hPredictor >= 7 || state[1]->hPredictor >= 7) {
+			goto invalid_predictor;
+		}
 		state[0]->iDelta = ((encoded[1]<<8)|encoded[0]);
 		encoded += sizeof(Sint16);
 		if ( stereo ) {
@@ -217,6 +220,10 @@ too_short:
 	SDL_SetError("Too short chunk for a MS ADPCM decoder");
 	SDL_free(freeable);
 	return(-1);
+invalid_predictor:
+	SDL_SetError("Invalid predictor value for a MS ADPCM decoder");
+	SDL_free(freeable);
+	return(-1);
 }
 
 struct IMA_ADPCM_decodestate {