diff --git a/debian/patches/0199-Fixed-use-after-free-in-music_fluidsynth.c.patch b/debian/patches/0199-Fixed-use-after-free-in-music_fluidsynth.c.patch new file mode 100644 index 0000000..0a04e59 --- /dev/null +++ b/debian/patches/0199-Fixed-use-after-free-in-music_fluidsynth.c.patch @@ -0,0 +1,28 @@ +From 6160668079f91d57a5d7bf0b40ffdd843be70daf Mon Sep 17 00:00:00 2001 +From: Sam Lantinga +Date: Wed, 20 Jan 2021 10:17:10 -0800 +Subject: [PATCH 199/199] Fixed use-after-free in music_fluidsynth.c + +Tom M. + +There is a dangerous use-after-free in FLUIDSYNTH_Delete(): the settings object is deleted **before** the synth. Since the settings have been created first to initialize the synth, you must first delete the synth and then delete the settings. This currently crashes all applications that use fluidsynth 2.1.6 and SDL2_mixer. Please apply the attached patch and release a bug fix release. + +Originally reported at https://github.com/FluidSynth/fluidsynth/issues/748 +--- + src/codecs/music_fluidsynth.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/music_fluidsynth.c ++++ b/music_fluidsynth.c +@@ -273,9 +273,10 @@ static void FLUIDSYNTH_Stop(void *contex + static void FLUIDSYNTH_Delete(void *context) + { + FLUIDSYNTH_Music *music = (FLUIDSYNTH_Music *)context; ++ fluid_settings_t *settings = fluidsynth.fluid_synth_get_settings(music->synth); + fluidsynth.delete_fluid_player(music->player); +- fluidsynth.delete_fluid_settings(fluidsynth.fluid_synth_get_settings(music->synth)); + fluidsynth.delete_fluid_synth(music->synth); ++ fluidsynth.delete_fluid_settings(settings); + SDL_free(music); + } + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..d2ea396 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0199-Fixed-use-after-free-in-music_fluidsynth.c.patch