File 0001-use-after-free-fluidsynth.patch of Package SDL2_mixer
31
1
From adee41d0c5211142c3422c889dcda8ccf9aad34f Mon Sep 17 00:00:00 2001
2
From: Sam Lantinga <slouken@libsdl.org>
3
Date: Wed, 20 Jan 2021 10:17:10 -0800
4
Subject: [PATCH] Fixed use-after-free in music_fluidsynth.c
5
6
Tom M.
7
8
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.
9
10
Originally reported at https://github.com/FluidSynth/fluidsynth/issues/748
11
---
12
src/codecs/music_fluidsynth.c | 3 ++-
13
1 file changed, 2 insertions(+), 1 deletion(-)
14
15
diff --git a/src/codecs/music_fluidsynth.c b/src/codecs/music_fluidsynth.c
16
index 8667f0d9..a47247f4 100644
17
--- a/music_fluidsynth.c 2018-10-31 15:59:00.000000000 +0100
18
+++ b/music_fluidsynth.c 2021-01-20 18:29:11.610459000 +0100
19
20
static void FLUIDSYNTH_Delete(void *context)
21
{
22
FLUIDSYNTH_Music *music = (FLUIDSYNTH_Music *)context;
23
+ fluid_settings_t *settings = fluidsynth.fluid_synth_get_settings(music->synth);
24
fluidsynth.delete_fluid_player(music->player);
25
- fluidsynth.delete_fluid_settings(fluidsynth.fluid_synth_get_settings(music->synth));
26
fluidsynth.delete_fluid_synth(music->synth);
27
+ fluidsynth.delete_fluid_settings(settings);
28
SDL_free(music);
29
}
30
31