diff options
Diffstat (limited to 'meta/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch')
-rw-r--r-- | meta/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/meta/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch b/meta/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch new file mode 100644 index 0000000000..7028890333 --- /dev/null +++ b/meta/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | # HG changeset patch | ||
2 | # User Petr Písař <ppisar@redhat.com> | ||
3 | # Date 1560042129 25200 | ||
4 | # Sat Jun 08 18:02:09 2019 -0700 | ||
5 | # Branch SDL-1.2 | ||
6 | # Node ID 388987dff7bf8f1e214e69c2e4f1aa31e06396b5 | ||
7 | # Parent e52413f5258600878f9a10d2f92605a729aa8976 | ||
8 | CVE-2019-7578: Fix a buffer overread in InitIMA_ADPCM | ||
9 | If IMA ADPCM format chunk was too short, InitIMA_ADPCM() parsing it | ||
10 | could read past the end of chunk data. This patch fixes it. | ||
11 | |||
12 | CVE-2019-7578 | ||
13 | https://bugzilla.libsdl.org/show_bug.cgi?id=4494 | ||
14 | |||
15 | Signed-off-by: Petr Písař <ppisar@redhat.com> | ||
16 | |||
17 | CVE: CVE-2019-7578 | ||
18 | Upstream-Status: Backport | ||
19 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> | ||
20 | |||
21 | diff -r e52413f52586 -r 388987dff7bf src/audio/SDL_wave.c | ||
22 | --- a/src/audio/SDL_wave.c Sat Jun 08 17:57:43 2019 -0700 | ||
23 | +++ b/src/audio/SDL_wave.c Sat Jun 08 18:02:09 2019 -0700 | ||
24 | @@ -222,11 +222,12 @@ | ||
25 | struct IMA_ADPCM_decodestate state[2]; | ||
26 | } IMA_ADPCM_state; | ||
27 | |||
28 | -static int InitIMA_ADPCM(WaveFMT *format) | ||
29 | +static int InitIMA_ADPCM(WaveFMT *format, int length) | ||
30 | { | ||
31 | - Uint8 *rogue_feel; | ||
32 | + Uint8 *rogue_feel, *rogue_feel_end; | ||
33 | |||
34 | /* Set the rogue pointer to the IMA_ADPCM specific data */ | ||
35 | + if (length < sizeof(*format)) goto too_short; | ||
36 | IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); | ||
37 | IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); | ||
38 | IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); | ||
39 | @@ -235,11 +236,16 @@ | ||
40 | IMA_ADPCM_state.wavefmt.bitspersample = | ||
41 | SDL_SwapLE16(format->bitspersample); | ||
42 | rogue_feel = (Uint8 *)format+sizeof(*format); | ||
43 | + rogue_feel_end = (Uint8 *)format + length; | ||
44 | if ( sizeof(*format) == 16 ) { | ||
45 | rogue_feel += sizeof(Uint16); | ||
46 | } | ||
47 | + if (rogue_feel + 2 > rogue_feel_end) goto too_short; | ||
48 | IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]); | ||
49 | return(0); | ||
50 | +too_short: | ||
51 | + SDL_SetError("Unexpected length of a chunk with an IMA ADPCM format"); | ||
52 | + return(-1); | ||
53 | } | ||
54 | |||
55 | static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble) | ||
56 | @@ -471,7 +477,7 @@ | ||
57 | break; | ||
58 | case IMA_ADPCM_CODE: | ||
59 | /* Try to understand this */ | ||
60 | - if ( InitIMA_ADPCM(format) < 0 ) { | ||
61 | + if ( InitIMA_ADPCM(format, lenread) < 0 ) { | ||
62 | was_error = 1; | ||
63 | goto done; | ||
64 | } | ||