summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Swanson2015-04-07 17:02:36 -0700
committerMike Swanson2015-04-07 17:02:36 -0700
commit2b43fdece66c666691afa9020db999c8bc126170 (patch)
treeccc692b662fdc9930d880f9aa805ce12ecd7e738
parenta32e9716c3ffee50e9ebc33d543a0eb02094a1a0 (diff)
downloadaur-2b43fdece66c666691afa9020db999c8bc126170.tar.gz
cherry-pick another commit to fix Setup crash
Setup would crash when selecting any dialog that contains a list of IWADs to select if there are more than eight available on the system. I happen to have a set of ten IWADs that triggered this crash.
-rw-r--r--.SRCINFO8
-rw-r--r--0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch6
-rw-r--r--0002-Ignore-metadata-loop-tags-if-both-are-zero.patch6
-rw-r--r--0003-setup-dynamically-set-size-of-iwad_labels-array.patch53
-rw-r--r--PKGBUILD11
5 files changed, 71 insertions, 13 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a2be0a81101c..21dab22cfb66 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = chocolate-doom
pkgdesc = Historically-accurate Doom, Heretic, Hexen, and Strife ports.
pkgver = 2.1.0
- pkgrel = 2
+ pkgrel = 3
url = http://www.chocolate-doom.org/
arch = i686
arch = x86_64
@@ -13,9 +13,11 @@ pkgbase = chocolate-doom
source = http://chocolate-doom.org/downloads/2.1.0/chocolate-doom-2.1.0.tar.gz
source = 0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch
source = 0002-Ignore-metadata-loop-tags-if-both-are-zero.patch
+ source = 0003-setup-dynamically-set-size-of-iwad_labels-array.patch
sha256sums = 629305e7f328659f3e93e89b93adc9da4e99b5a351e51ceb749dcf3e3da8bcd3
- sha256sums = cb611700a63a3d4cb58b030d4801c6f331ce7bd08708c281b9385fe1f82066f5
- sha256sums = 6330a3b1e6cde2db2554ca709925f2eb63f91df8f14b84946a7f50cff2f52ca3
+ sha256sums = 39a9e9452167b59f2482a8b4a81cf433c3ae1ca9b0fac69ac94beecee554135b
+ sha256sums = 33952a8eb4de22b4304654ce3b62ca9009d084e2be4cb0cd338237137d698880
+ sha256sums = 46b578981aa936b73da359e8f3bbf72a485402a7bc14ac9d92a64490fff51b6c
pkgname = chocolate-doom
pkgdesc = Doom port accurately reproducing the original DOS EXEs.
diff --git a/0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch b/0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch
index df5c1e3a132c..de0f70c18404 100644
--- a/0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch
+++ b/0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch
@@ -1,7 +1,7 @@
-From 5616ae0648ae9e11b3d9f4c889adecf0e6628a99 Mon Sep 17 00:00:00 2001
+From 9993a05606353b0088df4fbbcaa10232a96d4bbe Mon Sep 17 00:00:00 2001
From: Simon Howard <fraggle@gmail.com>
Date: Fri, 24 Oct 2014 19:41:57 -0400
-Subject: [PATCH 1/2] Ignore loop tags on non-looping substitute tracks.
+Subject: [PATCH 1/3] Ignore loop tags on non-looping substitute tracks.
If a substitute music track is played in a non-looping configuration
(eg. the title screen music), ignore loop tags in the file to be
@@ -72,5 +72,5 @@ index cca4132..16c5d51 100644
RestartCurrentTrack();
}
--
-2.1.2
+2.3.5
diff --git a/0002-Ignore-metadata-loop-tags-if-both-are-zero.patch b/0002-Ignore-metadata-loop-tags-if-both-are-zero.patch
index 9245ff9da3a9..791942164abc 100644
--- a/0002-Ignore-metadata-loop-tags-if-both-are-zero.patch
+++ b/0002-Ignore-metadata-loop-tags-if-both-are-zero.patch
@@ -1,7 +1,7 @@
-From 9c480b1cb18544240f433f90fca7e489eae35aff Mon Sep 17 00:00:00 2001
+From 401b108d064c2a4a7b011b0368823427b388351c Mon Sep 17 00:00:00 2001
From: Simon Howard <fraggle@gmail.com>
Date: Fri, 24 Oct 2014 19:48:01 -0400
-Subject: [PATCH 2/2] Ignore metadata loop tags if both are zero.
+Subject: [PATCH 2/3] Ignore metadata loop tags if both are zero.
If LOOP_START and LOOP_END are both set to zero, ignore them. This
is consistent with other source ports.
@@ -28,5 +28,5 @@ index 16c5d51..b8c2b2f 100644
// Given a MUS lump, look up a substitute MUS file to play instead
--
-2.1.2
+2.3.5
diff --git a/0003-setup-dynamically-set-size-of-iwad_labels-array.patch b/0003-setup-dynamically-set-size-of-iwad_labels-array.patch
new file mode 100644
index 000000000000..0ace70c7856f
--- /dev/null
+++ b/0003-setup-dynamically-set-size-of-iwad_labels-array.patch
@@ -0,0 +1,53 @@
+From aa4b6727e65471f305a337400ebc36b3d74d442a Mon Sep 17 00:00:00 2001
+From: Fabian Greffrath <fabian+debian@greffrath.com>
+Date: Tue, 28 Oct 2014 06:27:33 +0100
+Subject: [PATCH 3/3] setup: dynamically set size of iwad_labels array
+
+With the addition of the Freedoom IWADs, the number of IWADs supported
+by chocolate-doom has been raised to 10. However, the iwad_labels[]
+array only holds place for up to 8 pointers. Incidently, I have all 10
+IWADs installed and trying to warp into a game from
+chocolate-doom-setup leads to an out-of-bounds access of this array
+and so the application crashes with a segmentation fault.
+
+Instead of increasing the array size to 10, which will bite us next
+time, I decided to set its size dynamically as soon as the number of
+IWADs of known.
+---
+ src/setup/multiplayer.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c
+index d833a49..2aaae9a 100644
+--- a/src/setup/multiplayer.c
++++ b/src/setup/multiplayer.c
+@@ -55,7 +55,7 @@ static const iwad_t fallback_iwads[] = {
+ // Array of IWADs found to be installed
+
+ static const iwad_t **found_iwads;
+-static char *iwad_labels[8];
++static char **iwad_labels;
+
+ // Index of the currently selected IWAD
+
+@@ -559,10 +559,16 @@ static txt_widget_t *IWADSelector(void)
+
+ for (i=0; found_iwads[i] != NULL; ++i)
+ {
+- iwad_labels[i] = found_iwads[i]->description;
+ ++num_iwads;
+ }
+
++ iwad_labels = malloc(sizeof(*iwad_labels) * num_iwads);
++
++ for (i=0; i < num_iwads; ++i)
++ {
++ iwad_labels[i] = found_iwads[i]->description;
++ }
++
+ // If no IWADs are found, provide Doom 2 as an option, but
+ // we're probably screwed.
+
+--
+2.3.5
+
diff --git a/PKGBUILD b/PKGBUILD
index 032ffc258e7c..4fa4ee71cbfe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@ pkgname=(chocolate-{doom,heretic,hexen,strife,common})
pkgbase=${pkgname[0]}
pkgdesc="Historically-accurate Doom, Heretic, Hexen, and Strife ports."
pkgver=2.1.0
-pkgrel=2
+pkgrel=3
arch=('i686' 'x86_64')
url="http://www.chocolate-doom.org/"
license=('GPL2')
@@ -12,10 +12,12 @@ depends=('libsamplerate' 'sdl_mixer' 'sdl_net')
makedepends=('python')
source=(http://chocolate-doom.org/downloads/${pkgver}/${pkgbase}-${pkgver}.tar.gz
0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch
- 0002-Ignore-metadata-loop-tags-if-both-are-zero.patch)
+ 0002-Ignore-metadata-loop-tags-if-both-are-zero.patch
+ 0003-setup-dynamically-set-size-of-iwad_labels-array.patch)
sha256sums=('629305e7f328659f3e93e89b93adc9da4e99b5a351e51ceb749dcf3e3da8bcd3'
- 'cb611700a63a3d4cb58b030d4801c6f331ce7bd08708c281b9385fe1f82066f5'
- '6330a3b1e6cde2db2554ca709925f2eb63f91df8f14b84946a7f50cff2f52ca3')
+ '39a9e9452167b59f2482a8b4a81cf433c3ae1ca9b0fac69ac94beecee554135b'
+ '33952a8eb4de22b4304654ce3b62ca9009d084e2be4cb0cd338237137d698880'
+ '46b578981aa936b73da359e8f3bbf72a485402a7bc14ac9d92a64490fff51b6c')
prepare() {
cd "${pkgbase}-${pkgver}"
@@ -25,6 +27,7 @@ prepare() {
patch -p1 -i ../0001-Ignore-loop-tags-on-non-looping-substitute-tracks.patch
patch -p1 -i ../0002-Ignore-metadata-loop-tags-if-both-are-zero.patch
+ patch -p1 -i ../0003-setup-dynamically-set-size-of-iwad_labels-array.patch
}
build() {