summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15
diff options
context:
space:
mode:
authorAnuj Mittal <anuj.mittal@intel.com>2019-07-24 07:57:28 +0800
committerKhem Raj <raj.khem@gmail.com>2019-07-23 18:39:29 -0700
commit915098ffaec33087c552bacf6393e3fcac24ef9c (patch)
tree3336f94ee3098529a9a3257dba9ceaf429ac63ee /meta-oe/recipes-graphics/libsdl/libsdl-1.2.15
parentccf2220ab2e718c89d5fb576772c3120b90f69b9 (diff)
downloadmeta-openembedded-915098ffaec33087c552bacf6393e3fcac24ef9c.tar.gz
libsdl: import from OE-Core
Include the recipe from OE-Core along with some additional patches to fix CVEs. Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-graphics/libsdl/libsdl-1.2.15')
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-build-Pass-tag-CC-explictly-when-using-libtool.patch73
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7572.patch114
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7574.patch68
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7575.patch81
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7576.patch80
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7577.patch123
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch64
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7635.patch63
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7637.patch192
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7638.patch38
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/libsdl-1.2.15-xdata32.patch19
-rw-r--r--meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/pkgconfig.patch187
12 files changed, 1102 insertions, 0 deletions
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-build-Pass-tag-CC-explictly-when-using-libtool.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-build-Pass-tag-CC-explictly-when-using-libtool.patch
new file mode 100644
index 000000000..ec8c0fd4f
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-build-Pass-tag-CC-explictly-when-using-libtool.patch
@@ -0,0 +1,73 @@
1From 44e4bb4cfb81024c8f5fd2e179e8a32c42756a2f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 23 Jul 2017 16:52:43 -0700
4Subject: [PATCH] build: Pass --tag=CC explictly when using libtool
5
6Do not depend solely on libtool heuristics which fail
7in OE case when building with external compiler and
8hardening flags
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 Makefile.in | 4 ++--
15 build-scripts/makedep.sh | 8 ++++----
16 2 files changed, 6 insertions(+), 6 deletions(-)
17
18diff --git a/Makefile.in b/Makefile.in
19index ab51035..743ce30 100644
20--- a/Makefile.in
21+++ b/Makefile.in
22@@ -72,10 +72,10 @@ depend:
23 include $(depend)
24
25 $(objects)/$(TARGET): $(OBJECTS)
26- $(LIBTOOL) --mode=link $(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
27+ $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
28
29 $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
30- $(LIBTOOL) --mode=link $(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) $(SDLMAIN_LDFLAGS)
31+ $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) $(SDLMAIN_LDFLAGS)
32
33
34 install: all install-bin install-hdrs install-lib install-data install-man
35diff --git a/build-scripts/makedep.sh b/build-scripts/makedep.sh
36index 3b3863b..dba28f2 100755
37--- a/build-scripts/makedep.sh
38+++ b/build-scripts/makedep.sh
39@@ -51,19 +51,19 @@ do echo "Generating dependencies for $src"
40 case $ext in
41 c) cat >>${output}.new <<__EOF__
42
43- \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
44+ \$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
45
46 __EOF__
47 ;;
48 cc) cat >>${output}.new <<__EOF__
49
50- \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
51+ \$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
52
53 __EOF__
54 ;;
55 m) cat >>${output}.new <<__EOF__
56
57- \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
58+ \$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
59
60 __EOF__
61 ;;
62@@ -75,7 +75,7 @@ __EOF__
63 ;;
64 S) cat >>${output}.new <<__EOF__
65
66- \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
67+ \$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
68
69 __EOF__
70 ;;
71--
722.13.3
73
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7572.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7572.patch
new file mode 100644
index 000000000..c41c2de0f
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7572.patch
@@ -0,0 +1,114 @@
1# HG changeset patch
2# User Petr Písař <ppisar@redhat.com>
3# Date 1560182231 25200
4# Mon Jun 10 08:57:11 2019 -0700
5# Branch SDL-1.2
6# Node ID a8afedbcaea0e84921dc770195c4699bda3ccdc5
7# Parent faf9abbcfb5fe0d0ca23c4bf0394aa226ceccf02
8CVE-2019-7572: Fix a buffer overwrite in IMA_ADPCM_decode
9If data chunk was longer than expected based on a WAV format
10definition, IMA_ADPCM_decode() tried to write past the output
11buffer. This patch fixes it.
12
13Based on patch from
14<https://bugzilla.libsdl.org/show_bug.cgi?id=4496>.
15
16CVE-2019-7572
17https://bugzilla.libsdl.org/show_bug.cgi?id=4495
18
19Signed-off-by: Petr Písař <ppisar@redhat.com>
20
21# HG changeset patch
22# User Petr Písař <ppisar@redhat.com>
23# Date 1560041863 25200
24# Sat Jun 08 17:57:43 2019 -0700
25# Branch SDL-1.2
26# Node ID e52413f5258600878f9a10d2f92605a729aa8976
27# Parent 4e73be7b47877ae11d2279bd916910d469d18f8e
28CVE-2019-7572: Fix a buffer overread in IMA_ADPCM_nibble
29If an IMA ADPCM block contained an initial index out of step table
30range (loaded in IMA_ADPCM_decode()), IMA_ADPCM_nibble() blindly used
31this bogus value and that lead to a buffer overread.
32
33This patch fixes it by moving clamping the index value at the
34beginning of IMA_ADPCM_nibble() function instead of the end after
35an update.
36
37CVE-2019-7572
38https://bugzilla.libsdl.org/show_bug.cgi?id=4495
39
40Signed-off-by: Petr Písař <ppisar@redhat.com>
41
42CVE: CVE-2019-7572
43Upstream-Status: Backport
44Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
45
46diff -r faf9abbcfb5f -r a8afedbcaea0 src/audio/SDL_wave.c
47--- a/src/audio/SDL_wave.c Mon Jun 10 08:54:29 2019 -0700
48+++ b/src/audio/SDL_wave.c Mon Jun 10 08:57:11 2019 -0700
49@@ -346,7 +346,7 @@
50 static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
51 {
52 struct IMA_ADPCM_decodestate *state;
53- Uint8 *freeable, *encoded, *encoded_end, *decoded;
54+ Uint8 *freeable, *encoded, *encoded_end, *decoded, *decoded_end;
55 Sint32 encoded_len, samplesleft;
56 unsigned int c, channels;
57
58@@ -373,6 +373,7 @@
59 return(-1);
60 }
61 decoded = *audio_buf;
62+ decoded_end = decoded + *audio_len;
63
64 /* Get ready... Go! */
65 while ( encoded_len >= IMA_ADPCM_state.wavefmt.blockalign ) {
66@@ -392,6 +393,7 @@
67 }
68
69 /* Store the initial sample we start with */
70+ if (decoded + 2 > decoded_end) goto invalid_size;
71 decoded[0] = (Uint8)(state[c].sample&0xFF);
72 decoded[1] = (Uint8)(state[c].sample>>8);
73 decoded += 2;
74@@ -402,6 +404,8 @@
75 while ( samplesleft > 0 ) {
76 for ( c=0; c<channels; ++c ) {
77 if (encoded + 4 > encoded_end) goto invalid_size;
78+ if (decoded + 4 * 4 * channels > decoded_end)
79+ goto invalid_size;
80 Fill_IMA_ADPCM_block(decoded, encoded,
81 c, channels, &state[c]);
82 encoded += 4;
83
84diff -r 4e73be7b4787 -r e52413f52586 src/audio/SDL_wave.c
85--- a/src/audio/SDL_wave.c Sat Jun 01 18:27:46 2019 +0100
86+++ b/src/audio/SDL_wave.c Sat Jun 08 17:57:43 2019 -0700
87@@ -264,6 +264,14 @@
88 };
89 Sint32 delta, step;
90
91+ /* Clamp index value. The inital value can be invalid. */
92+ if ( state->index > 88 ) {
93+ state->index = 88;
94+ } else
95+ if ( state->index < 0 ) {
96+ state->index = 0;
97+ }
98+
99 /* Compute difference and new sample value */
100 step = step_table[state->index];
101 delta = step >> 3;
102@@ -275,12 +283,6 @@
103
104 /* Update index value */
105 state->index += index_table[nybble];
106- if ( state->index > 88 ) {
107- state->index = 88;
108- } else
109- if ( state->index < 0 ) {
110- state->index = 0;
111- }
112
113 /* Clamp output sample */
114 if ( state->sample > max_audioval ) {
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7574.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7574.patch
new file mode 100644
index 000000000..9fd53da29
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7574.patch
@@ -0,0 +1,68 @@
1# HG changeset patch
2# User Petr Písař <ppisar@redhat.com>
3# Date 1560181859 25200
4# Mon Jun 10 08:50:59 2019 -0700
5# Branch SDL-1.2
6# Node ID a6e3d2f5183e1cc300ad993e10e9ce077e13bd9c
7# Parent 388987dff7bf8f1e214e69c2e4f1aa31e06396b5
8CVE-2019-7574: Fix a buffer overread in IMA_ADPCM_decode
9If data chunk was shorter than expected based on a WAV format
10definition, IMA_ADPCM_decode() tried to read past the data chunk
11buffer. This patch fixes it.
12
13CVE-2019-7574
14https://bugzilla.libsdl.org/show_bug.cgi?id=4496
15
16Signed-off-by: Petr Písař <ppisar@redhat.com>
17
18CVE: CVE-2019-7574
19Upstream-Status: Backport
20Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
21
22diff -r 388987dff7bf -r a6e3d2f5183e src/audio/SDL_wave.c
23--- a/src/audio/SDL_wave.c Sat Jun 08 18:02:09 2019 -0700
24+++ b/src/audio/SDL_wave.c Mon Jun 10 08:50:59 2019 -0700
25@@ -331,7 +331,7 @@
26 static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
27 {
28 struct IMA_ADPCM_decodestate *state;
29- Uint8 *freeable, *encoded, *decoded;
30+ Uint8 *freeable, *encoded, *encoded_end, *decoded;
31 Sint32 encoded_len, samplesleft;
32 unsigned int c, channels;
33
34@@ -347,6 +347,7 @@
35 /* Allocate the proper sized output buffer */
36 encoded_len = *audio_len;
37 encoded = *audio_buf;
38+ encoded_end = encoded + encoded_len;
39 freeable = *audio_buf;
40 *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) *
41 IMA_ADPCM_state.wSamplesPerBlock*
42@@ -362,6 +363,7 @@
43 while ( encoded_len >= IMA_ADPCM_state.wavefmt.blockalign ) {
44 /* Grab the initial information for this block */
45 for ( c=0; c<channels; ++c ) {
46+ if (encoded + 4 > encoded_end) goto invalid_size;
47 /* Fill the state information for this block */
48 state[c].sample = ((encoded[1]<<8)|encoded[0]);
49 encoded += 2;
50@@ -384,6 +386,7 @@
51 samplesleft = (IMA_ADPCM_state.wSamplesPerBlock-1)*channels;
52 while ( samplesleft > 0 ) {
53 for ( c=0; c<channels; ++c ) {
54+ if (encoded + 4 > encoded_end) goto invalid_size;
55 Fill_IMA_ADPCM_block(decoded, encoded,
56 c, channels, &state[c]);
57 encoded += 4;
58@@ -395,6 +398,10 @@
59 }
60 SDL_free(freeable);
61 return(0);
62+invalid_size:
63+ SDL_SetError("Unexpected chunk length for an IMA ADPCM decoder");
64+ SDL_free(freeable);
65+ return(-1);
66 }
67
68 SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7575.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7575.patch
new file mode 100644
index 000000000..a3e8416d0
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7575.patch
@@ -0,0 +1,81 @@
1# HG changeset patch
2# User Petr Písař <ppisar@redhat.com>
3# Date 1560183905 25200
4# Mon Jun 10 09:25:05 2019 -0700
5# Branch SDL-1.2
6# Node ID a936f9bd3e381d67d8ddee8b9243f85799ea4798
7# Parent fcbecae427951bac1684baaba2ade68221315140
8CVE-2019-7575: Fix a buffer overwrite in MS_ADPCM_decode
9If a WAV format defines shorter audio stream and decoded MS ADPCM data chunk
10is longer, decoding continued past the output audio buffer.
11
12This fix is based on a patch from
13<https://bugzilla.libsdl.org/show_bug.cgi?id=4492>.
14
15https://bugzilla.libsdl.org/show_bug.cgi?id=4493
16CVE-2019-7575
17
18Signed-off-by: Petr Písař <ppisar@redhat.com>
19
20CVE: CVE-2019-7575
21Upstream-Status: Backport
22Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
23
24diff -r fcbecae42795 -r a936f9bd3e38 src/audio/SDL_wave.c
25--- a/src/audio/SDL_wave.c Mon Jun 10 09:06:23 2019 -0700
26+++ b/src/audio/SDL_wave.c Mon Jun 10 09:25:05 2019 -0700
27@@ -122,7 +122,7 @@
28 static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
29 {
30 struct MS_ADPCM_decodestate *state[2];
31- Uint8 *freeable, *encoded, *encoded_end, *decoded;
32+ Uint8 *freeable, *encoded, *encoded_end, *decoded, *decoded_end;
33 Sint32 encoded_len, samplesleft;
34 Sint8 nybble, stereo;
35 Sint16 *coeff[2];
36@@ -142,6 +142,7 @@
37 return(-1);
38 }
39 decoded = *audio_buf;
40+ decoded_end = decoded + *audio_len;
41
42 /* Get ready... Go! */
43 stereo = (MS_ADPCM_state.wavefmt.channels == 2);
44@@ -149,7 +150,7 @@
45 state[1] = &MS_ADPCM_state.state[stereo];
46 while ( encoded_len >= MS_ADPCM_state.wavefmt.blockalign ) {
47 /* Grab the initial information for this block */
48- if (encoded + 7 + (stereo ? 7 : 0) > encoded_end) goto too_short;
49+ if (encoded + 7 + (stereo ? 7 : 0) > encoded_end) goto invalid_size;
50 state[0]->hPredictor = *encoded++;
51 if ( stereo ) {
52 state[1]->hPredictor = *encoded++;
53@@ -179,6 +180,7 @@
54 coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor];
55
56 /* Store the two initial samples we start with */
57+ if (decoded + 4 + (stereo ? 4 : 0) > decoded_end) goto invalid_size;
58 decoded[0] = state[0]->iSamp2&0xFF;
59 decoded[1] = state[0]->iSamp2>>8;
60 decoded += 2;
61@@ -200,7 +202,8 @@
62 samplesleft = (MS_ADPCM_state.wSamplesPerBlock-2)*
63 MS_ADPCM_state.wavefmt.channels;
64 while ( samplesleft > 0 ) {
65- if (encoded + 1 > encoded_end) goto too_short;
66+ if (encoded + 1 > encoded_end) goto invalid_size;
67+ if (decoded + 4 > decoded_end) goto invalid_size;
68
69 nybble = (*encoded)>>4;
70 new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]);
71@@ -223,8 +226,8 @@
72 }
73 SDL_free(freeable);
74 return(0);
75-too_short:
76- SDL_SetError("Too short chunk for a MS ADPCM decoder");
77+invalid_size:
78+ SDL_SetError("Unexpected chunk length for a MS ADPCM decoder");
79 SDL_free(freeable);
80 return(-1);
81 invalid_predictor:
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7576.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7576.patch
new file mode 100644
index 000000000..d9a505217
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7576.patch
@@ -0,0 +1,80 @@
1# HG changeset patch
2# User Petr Písař <ppisar@redhat.com>
3# Date 1560182783 25200
4# Mon Jun 10 09:06:23 2019 -0700
5# Branch SDL-1.2
6# Node ID fcbecae427951bac1684baaba2ade68221315140
7# Parent a8afedbcaea0e84921dc770195c4699bda3ccdc5
8CVE-2019-7573, CVE-2019-7576: Fix buffer overreads in InitMS_ADPCM
9If MS ADPCM format chunk was too short, InitMS_ADPCM() parsing it
10could read past the end of chunk data. This patch fixes it.
11
12CVE-2019-7573
13https://bugzilla.libsdl.org/show_bug.cgi?id=4491
14CVE-2019-7576
15https://bugzilla.libsdl.org/show_bug.cgi?id=4490
16
17Signed-off-by: Petr Písař <ppisar@redhat.com>
18
19CVE: CVE-2019-7573
20CVE: CVE-2019-7576
21Upstream-Status: Backport
22Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
23
24diff -r a8afedbcaea0 -r fcbecae42795 src/audio/SDL_wave.c
25--- a/src/audio/SDL_wave.c Mon Jun 10 08:57:11 2019 -0700
26+++ b/src/audio/SDL_wave.c Mon Jun 10 09:06:23 2019 -0700
27@@ -44,12 +44,13 @@
28 struct MS_ADPCM_decodestate state[2];
29 } MS_ADPCM_state;
30
31-static int InitMS_ADPCM(WaveFMT *format)
32+static int InitMS_ADPCM(WaveFMT *format, int length)
33 {
34- Uint8 *rogue_feel;
35+ Uint8 *rogue_feel, *rogue_feel_end;
36 int i;
37
38 /* Set the rogue pointer to the MS_ADPCM specific data */
39+ if (length < sizeof(*format)) goto too_short;
40 MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
41 MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
42 MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
43@@ -58,9 +59,11 @@
44 MS_ADPCM_state.wavefmt.bitspersample =
45 SDL_SwapLE16(format->bitspersample);
46 rogue_feel = (Uint8 *)format+sizeof(*format);
47+ rogue_feel_end = (Uint8 *)format + length;
48 if ( sizeof(*format) == 16 ) {
49 rogue_feel += sizeof(Uint16);
50 }
51+ if (rogue_feel + 4 > rogue_feel_end) goto too_short;
52 MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]);
53 rogue_feel += sizeof(Uint16);
54 MS_ADPCM_state.wNumCoef = ((rogue_feel[1]<<8)|rogue_feel[0]);
55@@ -70,12 +73,16 @@
56 return(-1);
57 }
58 for ( i=0; i<MS_ADPCM_state.wNumCoef; ++i ) {
59+ if (rogue_feel + 4 > rogue_feel_end) goto too_short;
60 MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1]<<8)|rogue_feel[0]);
61 rogue_feel += sizeof(Uint16);
62 MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1]<<8)|rogue_feel[0]);
63 rogue_feel += sizeof(Uint16);
64 }
65 return(0);
66+too_short:
67+ SDL_SetError("Unexpected length of a chunk with a MS ADPCM format");
68+ return(-1);
69 }
70
71 static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
72@@ -495,7 +502,7 @@
73 break;
74 case MS_ADPCM_CODE:
75 /* Try to understand this */
76- if ( InitMS_ADPCM(format) < 0 ) {
77+ if ( InitMS_ADPCM(format, lenread) < 0 ) {
78 was_error = 1;
79 goto done;
80 }
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7577.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7577.patch
new file mode 100644
index 000000000..92e40aec5
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7577.patch
@@ -0,0 +1,123 @@
1# HG changeset patch
2# User Petr Písař <ppisar@redhat.com>
3# Date 1560182051 25200
4# Mon Jun 10 08:54:11 2019 -0700
5# Branch SDL-1.2
6# Node ID 416136310b88cbeeff8773e573e90ac1e22b3526
7# Parent a6e3d2f5183e1cc300ad993e10e9ce077e13bd9c
8CVE-2019-7577: Fix a buffer overread in MS_ADPCM_decode
9If RIFF/WAV data chunk length is shorter then expected for an audio
10format defined in preceeding RIFF/WAV format headers, a buffer
11overread can happen.
12
13This patch fixes it by checking a MS ADPCM data to be decoded are not
14past the initialized buffer.
15
16CVE-2019-7577
17Reproducer: https://bugzilla.libsdl.org/show_bug.cgi?id=4492
18
19Signed-off-by: Petr Písař <ppisar@redhat.com>
20
21# HG changeset patch
22# User Petr Písař <ppisar@redhat.com>
23# Date 1560182069 25200
24# Mon Jun 10 08:54:29 2019 -0700
25# Branch SDL-1.2
26# Node ID faf9abbcfb5fe0d0ca23c4bf0394aa226ceccf02
27# Parent 416136310b88cbeeff8773e573e90ac1e22b3526
28CVE-2019-7577: Fix a buffer overread in MS_ADPCM_nibble and MS_ADPCM_decode
29If a chunk of RIFF/WAV file with MS ADPCM encoding contains an invalid
30predictor (a valid predictor's value is between 0 and 6 inclusive),
31a buffer overread can happen when the predictor is used as an index
32into an array of MS ADPCM coefficients.
33
34The overead happens when indexing MS_ADPCM_state.aCoeff[] array in
35MS_ADPCM_decode() and later when dereferencing a coef pointer in
36MS_ADPCM_nibble().
37
38This patch fixes it by checking the MS ADPCM predictor values fit
39into the valid range.
40
41CVE-2019-7577
42Reproducer: https://bugzilla.libsdl.org/show_bug.cgi?id=4492
43
44Signed-off-by: Petr Písař <ppisar@redhat.com>
45
46CVE: CVE-2019-7577
47Upstream-Status: Backport
48Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
49
50diff -r a6e3d2f5183e -r 416136310b88 src/audio/SDL_wave.c
51--- a/src/audio/SDL_wave.c Mon Jun 10 08:50:59 2019 -0700
52+++ b/src/audio/SDL_wave.c Mon Jun 10 08:54:11 2019 -0700
53@@ -115,7 +115,7 @@
54 static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
55 {
56 struct MS_ADPCM_decodestate *state[2];
57- Uint8 *freeable, *encoded, *decoded;
58+ Uint8 *freeable, *encoded, *encoded_end, *decoded;
59 Sint32 encoded_len, samplesleft;
60 Sint8 nybble, stereo;
61 Sint16 *coeff[2];
62@@ -124,6 +124,7 @@
63 /* Allocate the proper sized output buffer */
64 encoded_len = *audio_len;
65 encoded = *audio_buf;
66+ encoded_end = encoded + encoded_len;
67 freeable = *audio_buf;
68 *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) *
69 MS_ADPCM_state.wSamplesPerBlock*
70@@ -141,6 +142,7 @@
71 state[1] = &MS_ADPCM_state.state[stereo];
72 while ( encoded_len >= MS_ADPCM_state.wavefmt.blockalign ) {
73 /* Grab the initial information for this block */
74+ if (encoded + 7 + (stereo ? 7 : 0) > encoded_end) goto too_short;
75 state[0]->hPredictor = *encoded++;
76 if ( stereo ) {
77 state[1]->hPredictor = *encoded++;
78@@ -188,6 +190,8 @@
79 samplesleft = (MS_ADPCM_state.wSamplesPerBlock-2)*
80 MS_ADPCM_state.wavefmt.channels;
81 while ( samplesleft > 0 ) {
82+ if (encoded + 1 > encoded_end) goto too_short;
83+
84 nybble = (*encoded)>>4;
85 new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]);
86 decoded[0] = new_sample&0xFF;
87@@ -209,6 +213,10 @@
88 }
89 SDL_free(freeable);
90 return(0);
91+too_short:
92+ SDL_SetError("Too short chunk for a MS ADPCM decoder");
93+ SDL_free(freeable);
94+ return(-1);
95 }
96
97 struct IMA_ADPCM_decodestate {
98
99
100diff -r 416136310b88 -r faf9abbcfb5f src/audio/SDL_wave.c
101--- a/src/audio/SDL_wave.c Mon Jun 10 08:54:11 2019 -0700
102+++ b/src/audio/SDL_wave.c Mon Jun 10 08:54:29 2019 -0700
103@@ -147,6 +147,9 @@
104 if ( stereo ) {
105 state[1]->hPredictor = *encoded++;
106 }
107+ if (state[0]->hPredictor >= 7 || state[1]->hPredictor >= 7) {
108+ goto invalid_predictor;
109+ }
110 state[0]->iDelta = ((encoded[1]<<8)|encoded[0]);
111 encoded += sizeof(Sint16);
112 if ( stereo ) {
113@@ -217,6 +220,10 @@
114 SDL_SetError("Too short chunk for a MS ADPCM decoder");
115 SDL_free(freeable);
116 return(-1);
117+invalid_predictor:
118+ SDL_SetError("Invalid predictor value for a MS ADPCM decoder");
119+ SDL_free(freeable);
120+ return(-1);
121 }
122
123 struct IMA_ADPCM_decodestate {
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7578.patch
new file mode 100644
index 000000000..702889033
--- /dev/null
+++ b/meta-oe/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
8CVE-2019-7578: Fix a buffer overread in InitIMA_ADPCM
9If IMA ADPCM format chunk was too short, InitIMA_ADPCM() parsing it
10could read past the end of chunk data. This patch fixes it.
11
12CVE-2019-7578
13https://bugzilla.libsdl.org/show_bug.cgi?id=4494
14
15Signed-off-by: Petr Písař <ppisar@redhat.com>
16
17CVE: CVE-2019-7578
18Upstream-Status: Backport
19Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
20
21diff -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 }
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7635.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7635.patch
new file mode 100644
index 000000000..78af1b061
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7635.patch
@@ -0,0 +1,63 @@
1# HG changeset patch
2# User Petr Písař <ppisar@redhat.com>
3# Date 1560259692 25200
4# Tue Jun 11 06:28:12 2019 -0700
5# Branch SDL-1.2
6# Node ID f1f5878be5dbf63c1161a8ee52b8a86ece30e552
7# Parent a936f9bd3e381d67d8ddee8b9243f85799ea4798
8CVE-2019-7635: Reject BMP images with pixel colors out the palette
9If a 1-, 4-, or 8-bit per pixel BMP image declares less used colors
10than the palette offers an SDL_Surface with a palette of the indicated
11number of used colors is created. If some of the image's pixel
12refer to a color number higher then the maximal used colors, a subsequent
13bliting operation on the surface will look up a color past a blit map
14(that is based on the palette) memory. I.e. passing such SDL_Surface
15to e.g. an SDL_DisplayFormat() function will result in a buffer overread in
16a blit function.
17
18This patch fixes it by validing each pixel's color to be less than the
19maximal color number in the palette. A validation failure raises an
20error from a SDL_LoadBMP_RW() function.
21
22CVE-2019-7635
23https://bugzilla.libsdl.org/show_bug.cgi?id=4498
24
25Signed-off-by: Petr Písař <ppisar@redhat.com>
26
27CVE: CVE-2019-7635
28Upstream-Status: Backport
29Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
30
31diff -r a936f9bd3e38 -r f1f5878be5db src/video/SDL_bmp.c
32--- a/src/video/SDL_bmp.c Mon Jun 10 09:25:05 2019 -0700
33+++ b/src/video/SDL_bmp.c Tue Jun 11 06:28:12 2019 -0700
34@@ -308,6 +308,12 @@
35 }
36 *(bits+i) = (pixel>>shift);
37 pixel <<= ExpandBMP;
38+ if ( bits[i] >= biClrUsed ) {
39+ SDL_SetError(
40+ "A BMP image contains a pixel with a color out of the palette");
41+ was_error = SDL_TRUE;
42+ goto done;
43+ }
44 } }
45 break;
46
47@@ -318,6 +324,16 @@
48 was_error = SDL_TRUE;
49 goto done;
50 }
51+ if ( 8 == biBitCount && palette && biClrUsed < (1 << biBitCount ) ) {
52+ for ( i=0; i<surface->w; ++i ) {
53+ if ( bits[i] >= biClrUsed ) {
54+ SDL_SetError(
55+ "A BMP image contains a pixel with a color out of the palette");
56+ was_error = SDL_TRUE;
57+ goto done;
58+ }
59+ }
60+ }
61 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
62 /* Byte-swap the pixels if needed. Note that the 24bpp
63 case has already been taken care of above. */
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7637.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7637.patch
new file mode 100644
index 000000000..c95338e61
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7637.patch
@@ -0,0 +1,192 @@
1# HG changeset patch
2# User Petr Písař <ppisar@redhat.com>
3# Date 1552788984 25200
4# Sat Mar 16 19:16:24 2019 -0700
5# Branch SDL-1.2
6# Node ID 9b0e5c555c0f5ce6d2c3c19da6cc2c7fb5048bf2
7# Parent 4646533663ae1d80c2cc6b2d6dbfb37c62491c1e
8CVE-2019-7637: Fix in integer overflow in SDL_CalculatePitch
9If a too large width is passed to SDL_SetVideoMode() the width travels
10to SDL_CalculatePitch() where the width (e.g. 65535) is multiplied by
11BytesPerPixel (e.g. 4) and the result is stored into Uint16 pitch
12variable. During this arithmetics an integer overflow can happen (e.g.
13the value is clamped as 65532). As a result SDL_Surface with a pitch
14smaller than width * BytesPerPixel is created, too small pixel buffer
15is allocated and when the SDL_Surface is processed in SDL_FillRect()
16a buffer overflow occurs.
17
18This can be reproduced with "./graywin -width 21312312313123213213213"
19command.
20
21This patch fixes is by using a very careful arithmetics in
22SDL_CalculatePitch(). If an overflow is detected, an error is reported
23back as a special 0 value. We assume that 0-width surfaces do not
24occur in the wild. Since SDL_CalculatePitch() is a private function,
25we can change the semantics.
26
27CVE-2019-7637
28https://bugzilla.libsdl.org/show_bug.cgi?id=4497
29
30Signed-off-by: Petr Písař <ppisar@redhat.com>
31
32CVE: CVE-2019-7637
33Upstream-Status: Backport
34Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
35
36diff -r 4646533663ae -r 9b0e5c555c0f src/video/SDL_pixels.c
37--- a/src/video/SDL_pixels.c Sat Mar 16 18:35:33 2019 -0700
38+++ b/src/video/SDL_pixels.c Sat Mar 16 19:16:24 2019 -0700
39@@ -286,26 +286,53 @@
40 }
41 }
42 /*
43- * Calculate the pad-aligned scanline width of a surface
44+ * Calculate the pad-aligned scanline width of a surface. Return 0 in case of
45+ * an error.
46 */
47 Uint16 SDL_CalculatePitch(SDL_Surface *surface)
48 {
49- Uint16 pitch;
50+ unsigned int pitch = 0;
51
52 /* Surface should be 4-byte aligned for speed */
53- pitch = surface->w*surface->format->BytesPerPixel;
54+ /* The code tries to prevent from an Uint16 overflow. */;
55+ for (Uint8 byte = surface->format->BytesPerPixel; byte; byte--) {
56+ pitch += (unsigned int)surface->w;
57+ if (pitch < surface->w) {
58+ SDL_SetError("A scanline is too wide");
59+ return(0);
60+ }
61+ }
62 switch (surface->format->BitsPerPixel) {
63 case 1:
64- pitch = (pitch+7)/8;
65+ if (pitch % 8) {
66+ pitch = pitch / 8 + 1;
67+ } else {
68+ pitch = pitch / 8;
69+ }
70 break;
71 case 4:
72- pitch = (pitch+1)/2;
73+ if (pitch % 2) {
74+ pitch = pitch / 2 + 1;
75+ } else {
76+ pitch = pitch / 2;
77+ }
78 break;
79 default:
80 break;
81 }
82- pitch = (pitch + 3) & ~3; /* 4-byte aligning */
83- return(pitch);
84+ /* 4-byte aligning */
85+ if (pitch & 3) {
86+ if (pitch + 3 < pitch) {
87+ SDL_SetError("A scanline is too wide");
88+ return(0);
89+ }
90+ pitch = (pitch + 3) & ~3;
91+ }
92+ if (pitch > 0xFFFF) {
93+ SDL_SetError("A scanline is too wide");
94+ return(0);
95+ }
96+ return((Uint16)pitch);
97 }
98 /*
99 * Match an RGB value to a particular palette index
100diff -r 4646533663ae -r 9b0e5c555c0f src/video/gapi/SDL_gapivideo.c
101--- a/src/video/gapi/SDL_gapivideo.c Sat Mar 16 18:35:33 2019 -0700
102+++ b/src/video/gapi/SDL_gapivideo.c Sat Mar 16 19:16:24 2019 -0700
103@@ -733,6 +733,9 @@
104 video->w = gapi->w = width;
105 video->h = gapi->h = height;
106 video->pitch = SDL_CalculatePitch(video);
107+ if (!current->pitch) {
108+ return(NULL);
109+ }
110
111 /* Small fix for WinCE/Win32 - when activating window
112 SDL_VideoSurface is equal to zero, so activating code
113diff -r 4646533663ae -r 9b0e5c555c0f src/video/nanox/SDL_nxvideo.c
114--- a/src/video/nanox/SDL_nxvideo.c Sat Mar 16 18:35:33 2019 -0700
115+++ b/src/video/nanox/SDL_nxvideo.c Sat Mar 16 19:16:24 2019 -0700
116@@ -378,6 +378,10 @@
117 current -> w = width ;
118 current -> h = height ;
119 current -> pitch = SDL_CalculatePitch (current) ;
120+ if (!current->pitch) {
121+ current = NULL;
122+ goto done;
123+ }
124 NX_ResizeImage (this, current, flags) ;
125 }
126
127diff -r 4646533663ae -r 9b0e5c555c0f src/video/ps2gs/SDL_gsvideo.c
128--- a/src/video/ps2gs/SDL_gsvideo.c Sat Mar 16 18:35:33 2019 -0700
129+++ b/src/video/ps2gs/SDL_gsvideo.c Sat Mar 16 19:16:24 2019 -0700
130@@ -479,6 +479,9 @@
131 current->w = width;
132 current->h = height;
133 current->pitch = SDL_CalculatePitch(current);
134+ if (!current->pitch) {
135+ return(NULL);
136+ }
137
138 /* Memory map the DMA area for block memory transfer */
139 if ( ! mapped_mem ) {
140diff -r 4646533663ae -r 9b0e5c555c0f src/video/ps3/SDL_ps3video.c
141--- a/src/video/ps3/SDL_ps3video.c Sat Mar 16 18:35:33 2019 -0700
142+++ b/src/video/ps3/SDL_ps3video.c Sat Mar 16 19:16:24 2019 -0700
143@@ -339,6 +339,9 @@
144 current->w = width;
145 current->h = height;
146 current->pitch = SDL_CalculatePitch(current);
147+ if (!current->pitch) {
148+ return(NULL);
149+ }
150
151 /* Alloc aligned mem for current->pixels */
152 s_pixels = memalign(16, current->h * current->pitch);
153diff -r 4646533663ae -r 9b0e5c555c0f src/video/windib/SDL_dibvideo.c
154--- a/src/video/windib/SDL_dibvideo.c Sat Mar 16 18:35:33 2019 -0700
155+++ b/src/video/windib/SDL_dibvideo.c Sat Mar 16 19:16:24 2019 -0700
156@@ -675,6 +675,9 @@
157 video->w = width;
158 video->h = height;
159 video->pitch = SDL_CalculatePitch(video);
160+ if (!current->pitch) {
161+ return(NULL);
162+ }
163
164 /* Small fix for WinCE/Win32 - when activating window
165 SDL_VideoSurface is equal to zero, so activating code
166diff -r 4646533663ae -r 9b0e5c555c0f src/video/windx5/SDL_dx5video.c
167--- a/src/video/windx5/SDL_dx5video.c Sat Mar 16 18:35:33 2019 -0700
168+++ b/src/video/windx5/SDL_dx5video.c Sat Mar 16 19:16:24 2019 -0700
169@@ -1127,6 +1127,9 @@
170 video->w = width;
171 video->h = height;
172 video->pitch = SDL_CalculatePitch(video);
173+ if (!current->pitch) {
174+ return(NULL);
175+ }
176
177 #ifndef NO_CHANGEDISPLAYSETTINGS
178 /* Set fullscreen mode if appropriate.
179diff -r 4646533663ae -r 9b0e5c555c0f src/video/x11/SDL_x11video.c
180--- a/src/video/x11/SDL_x11video.c Sat Mar 16 18:35:33 2019 -0700
181+++ b/src/video/x11/SDL_x11video.c Sat Mar 16 19:16:24 2019 -0700
182@@ -1225,6 +1225,10 @@
183 current->w = width;
184 current->h = height;
185 current->pitch = SDL_CalculatePitch(current);
186+ if (!current->pitch) {
187+ current = NULL;
188+ goto done;
189+ }
190 if (X11_ResizeImage(this, current, flags) < 0) {
191 current = NULL;
192 goto done;
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7638.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7638.patch
new file mode 100644
index 000000000..dab9aaeb2
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/CVE-2019-7638.patch
@@ -0,0 +1,38 @@
1# HG changeset patch
2# User Sam Lantinga <slouken@libsdl.org>
3# Date 1550504903 28800
4# Mon Feb 18 07:48:23 2019 -0800
5# Branch SDL-1.2
6# Node ID 19d8c3b9c25143f71a34ff40ce1df91b4b3e3b78
7# Parent 8586f153eedec4c4e07066d6248ebdf67f10a229
8Fixed bug 4500 - Heap-Buffer Overflow in Map1toN pertaining to SDL_pixels.c
9
10Petr Pisar
11
12The reproducer has these data in BITMAPINFOHEADER:
13
14biSize = 40
15biBitCount = 8
16biClrUsed = 131075
17
18SDL_LoadBMP_RW() function passes biBitCount as a color depth to SDL_CreateRGBSurface(), thus 256-color pallete is allocated. But then biClrUsed colors are read from a file and stored into the palette. SDL_LoadBMP_RW should report an error if biClrUsed is greater than 2^biBitCount.
19
20CVE: CVE-2019-7638
21CVE: CVE-2019-7636
22Upstream-Status: Backport
23Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
24
25diff -r 8586f153eede -r 19d8c3b9c251 src/video/SDL_bmp.c
26--- a/src/video/SDL_bmp.c Sun Jan 13 15:27:50 2019 +0100
27+++ b/src/video/SDL_bmp.c Mon Feb 18 07:48:23 2019 -0800
28@@ -233,6 +233,10 @@
29 if ( palette ) {
30 if ( biClrUsed == 0 ) {
31 biClrUsed = 1 << biBitCount;
32+ } else if ( biClrUsed > (1 << biBitCount) ) {
33+ SDL_SetError("BMP file has an invalid number of colors");
34+ was_error = SDL_TRUE;
35+ goto done;
36 }
37 if ( biSize == 12 ) {
38 for ( i = 0; i < (int)biClrUsed; ++i ) {
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/libsdl-1.2.15-xdata32.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/libsdl-1.2.15-xdata32.patch
new file mode 100644
index 000000000..f98b92752
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/libsdl-1.2.15-xdata32.patch
@@ -0,0 +1,19 @@
1libX11-1.5.99.901 has changed prototype of _XData32
2
3Upstream-Status: Backport
4<http://bugzilla.libsdl.org/show_bug.cgi?id=1769>
5
6Signed-off-by: Saul Wold <sgw@linux.intel.com>
7
8diff -r b6b2829cd7ef src/video/x11/SDL_x11sym.h
9--- a/src/video/x11/SDL_x11sym.h Wed Feb 27 15:20:31 2013 -0800
10+++ b/src/video/x11/SDL_x11sym.h Wed Mar 27 16:07:23 2013 +0100
11@@ -165,7 +165,7 @@
12 */
13 #ifdef LONG64
14 SDL_X11_MODULE(IO_32BIT)
15-SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
16+SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
17 SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
18 #endif
19
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/pkgconfig.patch b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/pkgconfig.patch
new file mode 100644
index 000000000..913baa92a
--- /dev/null
+++ b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/pkgconfig.patch
@@ -0,0 +1,187 @@
1Rather than code which doesn't even work properly when cross compiling,
2lets just use pkg-config instead. Its a little simpler.
3
4RP 2014/6/20
5
6Upstream-Status: Pending
7
8Index: SDL-1.2.15/sdl.m4
9===================================================================
10--- SDL-1.2.15.orig/sdl.m4
11+++ SDL-1.2.15/sdl.m4
12@@ -12,174 +12,8 @@ dnl Test for SDL, and define SDL_CFLAGS
13 dnl
14 AC_DEFUN([AM_PATH_SDL],
15 [dnl
16-dnl Get the cflags and libraries from the sdl-config script
17-dnl
18-AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
19- sdl_prefix="$withval", sdl_prefix="")
20-AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
21- sdl_exec_prefix="$withval", sdl_exec_prefix="")
22-AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
23- , enable_sdltest=yes)
24-
25- if test x$sdl_exec_prefix != x ; then
26- sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
27- if test x${SDL_CONFIG+set} != xset ; then
28- SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
29- fi
30- fi
31- if test x$sdl_prefix != x ; then
32- sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
33- if test x${SDL_CONFIG+set} != xset ; then
34- SDL_CONFIG=$sdl_prefix/bin/sdl-config
35- fi
36- fi
37-
38- as_save_PATH="$PATH"
39- if test "x$prefix" != xNONE; then
40- PATH="$prefix/bin:$prefix/usr/bin:$PATH"
41- fi
42- AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
43- PATH="$as_save_PATH"
44 min_sdl_version=ifelse([$1], ,0.11.0,$1)
45- AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
46- no_sdl=""
47- if test "$SDL_CONFIG" = "no" ; then
48- no_sdl=yes
49- else
50- SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
51- SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
52-
53- sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
54- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
55- sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
56- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
57- sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
58- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
59- if test "x$enable_sdltest" = "xyes" ; then
60- ac_save_CFLAGS="$CFLAGS"
61- ac_save_CXXFLAGS="$CXXFLAGS"
62- ac_save_LIBS="$LIBS"
63- CFLAGS="$CFLAGS $SDL_CFLAGS"
64- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
65- LIBS="$LIBS $SDL_LIBS"
66-dnl
67-dnl Now check if the installed SDL is sufficiently new. (Also sanity
68-dnl checks the results of sdl-config to some extent
69-dnl
70- rm -f conf.sdltest
71- AC_TRY_RUN([
72-#include <stdio.h>
73-#include <stdlib.h>
74-#include <string.h>
75-#include "SDL.h"
76-
77-char*
78-my_strdup (char *str)
79-{
80- char *new_str;
81-
82- if (str)
83- {
84- new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
85- strcpy (new_str, str);
86- }
87- else
88- new_str = NULL;
89-
90- return new_str;
91-}
92-
93-int main (int argc, char *argv[])
94-{
95- int major, minor, micro;
96- char *tmp_version;
97-
98- /* This hangs on some systems (?)
99- system ("touch conf.sdltest");
100- */
101- { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
102-
103- /* HP/UX 9 (%@#!) writes to sscanf strings */
104- tmp_version = my_strdup("$min_sdl_version");
105- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
106- printf("%s, bad version string\n", "$min_sdl_version");
107- exit(1);
108- }
109-
110- if (($sdl_major_version > major) ||
111- (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
112- (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
113- {
114- return 0;
115- }
116- else
117- {
118- printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
119- printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
120- printf("*** best to upgrade to the required version.\n");
121- printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
122- printf("*** to point to the correct copy of sdl-config, and remove the file\n");
123- printf("*** config.cache before re-running configure\n");
124- return 1;
125- }
126-}
127-
128-],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
129- CFLAGS="$ac_save_CFLAGS"
130- CXXFLAGS="$ac_save_CXXFLAGS"
131- LIBS="$ac_save_LIBS"
132- fi
133- fi
134- if test "x$no_sdl" = x ; then
135- AC_MSG_RESULT(yes)
136- ifelse([$2], , :, [$2])
137- else
138- AC_MSG_RESULT(no)
139- if test "$SDL_CONFIG" = "no" ; then
140- echo "*** The sdl-config script installed by SDL could not be found"
141- echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
142- echo "*** your path, or set the SDL_CONFIG environment variable to the"
143- echo "*** full path to sdl-config."
144- else
145- if test -f conf.sdltest ; then
146- :
147- else
148- echo "*** Could not run SDL test program, checking why..."
149- CFLAGS="$CFLAGS $SDL_CFLAGS"
150- CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
151- LIBS="$LIBS $SDL_LIBS"
152- AC_TRY_LINK([
153-#include <stdio.h>
154-#include "SDL.h"
155-
156-int main(int argc, char *argv[])
157-{ return 0; }
158-#undef main
159-#define main K_and_R_C_main
160-], [ return 0; ],
161- [ echo "*** The test program compiled, but did not run. This usually means"
162- echo "*** that the run-time linker is not finding SDL or finding the wrong"
163- echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
164- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
165- echo "*** to the installed location Also, make sure you have run ldconfig if that"
166- echo "*** is required on your system"
167- echo "***"
168- echo "*** If you have an old version installed, it is best to remove it, although"
169- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
170- [ echo "*** The test program failed to compile or link. See the file config.log for the"
171- echo "*** exact error that occured. This usually means SDL was incorrectly installed"
172- echo "*** or that you have moved SDL since it was installed. In the latter case, you"
173- echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
174- CFLAGS="$ac_save_CFLAGS"
175- CXXFLAGS="$ac_save_CXXFLAGS"
176- LIBS="$ac_save_LIBS"
177- fi
178- fi
179- SDL_CFLAGS=""
180- SDL_LIBS=""
181- ifelse([$3], , :, [$3])
182- fi
183+ PKG_CHECK_MODULES([SDL], [sdl >= $min_sdl_version])
184 AC_SUBST(SDL_CFLAGS)
185 AC_SUBST(SDL_LIBS)
186- rm -f conf.sdltest
187 ])