From 031b740451593aee3ef1c22b59b99b207fd38614 Mon Sep 17 00:00:00 2001 From: Tom M Date: Mon, 6 Jul 2020 18:46:57 +0200 Subject: [PATCH 1/5] Update Doxyfile --- doc/Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 09105644..193f63a4 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = libfluidsynth -PROJECT_NUMBER = 2.1.3 +PROJECT_NUMBER = 2.1.4 OUTPUT_DIRECTORY = api CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English From 137a14e106d75d1260f78acc1a19c5a936ef75b2 Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 8 Jul 2020 19:10:29 +0200 Subject: [PATCH 2/5] Turn incompatible-pointer-types warning into error --- .travis.yml | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c65bdf9..6b5de751 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ addons: env: - CMAKE_FLAGS="-Denable-profiling=1" - CMAKE_FLAGS="-Denable-floats=1 -Denable-profiling=1" - - CMAKE_FLAGS="-Denable-floats=0" + - CMAKE_FLAGS="-Denable-floats=1" - CMAKE_FLAGS="-Denable-trap-on-fpe=1" - CMAKE_FLAGS="-Denable-fpe-check=1" - CMAKE_FLAGS="-Denable-ipv6=0" diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b812074..c933c8e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,7 +184,7 @@ if ( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_C endif ( NOT APPLE AND NOT OS2 ) # define some warning flags - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wno-unused-parameter -Wdeclaration-after-statement -Werror=implicit-function-declaration" ) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wno-unused-parameter -Wdeclaration-after-statement -Werror=implicit-function-declaration -Werror=incompatible-pointer-types" ) # prepend to build type specific flags, to allow users to override set ( CMAKE_C_FLAGS_DEBUG "-g ${CMAKE_C_FLAGS_DEBUG}" ) From 85f94c61c9ce6126ec56a35dba564a516ea14e15 Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 8 Jul 2020 19:20:13 +0200 Subject: [PATCH 3/5] Fix passing arguments from incompatible pointer type --- src/synth/fluid_synth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index 63c26ec4..e3ded7bc 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -609,7 +609,7 @@ new_fluid_synth(fluid_settings_t *settings) char *important_channels; int i, nbuf, prio_level = 0; int with_ladspa = 0; - fluid_real_t sample_rate_min, sample_rate_max; + double sample_rate_min, sample_rate_max; /* initialize all the conversion tables and other stuff */ if(fluid_atomic_int_compare_and_exchange(&fluid_synth_initialized, 0, 1)) @@ -789,7 +789,7 @@ new_fluid_synth(fluid_settings_t *settings) /* In an overflow situation, a new voice takes about 50 spaces in the queue! */ synth->eventhandler = new_fluid_rvoice_eventhandler(synth->polyphony * 64, synth->polyphony, nbuf, synth->effects_channels, synth->effects_groups, - sample_rate_max, synth->sample_rate, + (fluid_real_t)sample_rate_max, synth->sample_rate, synth->cores - 1, prio_level); if(synth->eventhandler == NULL) From eac0de03453b10220163400f08d4e76b626f0f80 Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 9 Jul 2020 19:10:11 +0200 Subject: [PATCH 4/5] Fix a NULL deref in jack driver --- src/drivers/fluid_jack.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/drivers/fluid_jack.c b/src/drivers/fluid_jack.c index d81d934a..4f7e3ad2 100644 --- a/src/drivers/fluid_jack.c +++ b/src/drivers/fluid_jack.c @@ -188,7 +188,8 @@ new_fluid_jack_client(fluid_settings_t *settings, int isaudio, void *driver) else { // do not free client_ref and do not goto error_recovery - // client_ref is being used by another audio or midi driver. Freeing it here will create a double free. + // client_ref is being used by another audio or midi driver. Freeing it here will lead to a double free. + client_ref = NULL; } fluid_mutex_unlock(last_client_mutex); /* -- unlock last_client */ @@ -357,7 +358,7 @@ fluid_jack_client_register_ports(void *driver, int isaudio, jack_client_t *clien if(dev->midi_port[i] == NULL) { - FLUID_LOG(FLUID_ERR, "Failed to create Jack MIDI port"); + FLUID_LOG(FLUID_ERR, "Failed to create Jack MIDI port '%s'", name); FLUID_FREE(dev->midi_port); dev->midi_port = NULL; return FLUID_FAILED; @@ -397,7 +398,8 @@ fluid_jack_client_register_ports(void *driver, int isaudio, jack_client_t *clien if(dev->output_ports[0] == NULL || dev->output_ports[1] == NULL) { - FLUID_LOG(FLUID_ERR, "Failed to create Jack audio port"); + FLUID_LOG(FLUID_ERR, "Failed to create Jack audio port '%s'", + (dev->output_ports[0] == NULL ? (dev->output_ports[1] == NULL ? "left & right" : "left") : "right")); goto error_recovery; } } @@ -869,7 +871,6 @@ new_fluid_jack_midi_driver(fluid_settings_t *settings, if(!dev->client_ref) { - FLUID_LOG(FLUID_PANIC, "Out of memory"); goto error_recovery; } From d7abe8bdfd51fc44284073400c165b1f20314d70 Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 9 Jul 2020 19:30:32 +0200 Subject: [PATCH 5/5] Fix a possible race condition during midi autoconnect --- src/drivers/fluid_jack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/drivers/fluid_jack.c b/src/drivers/fluid_jack.c index 4f7e3ad2..d12307ce 100644 --- a/src/drivers/fluid_jack.c +++ b/src/drivers/fluid_jack.c @@ -83,7 +83,7 @@ struct _fluid_jack_midi_driver_t jack_port_t **midi_port; // array of midi port handles fluid_midi_parser_t *parser; int autoconnect_inputs; - int autoconnect_is_outdated; + fluid_atomic_int_t autoconnect_is_outdated; }; static fluid_jack_client_t *new_fluid_jack_client(fluid_settings_t *settings, @@ -136,7 +136,7 @@ fluid_jack_midi_autoconnect(jack_client_t *client, fluid_jack_midi_driver_t *mid jack_free(midi_source_ports); } - midi_driver->autoconnect_is_outdated = FALSE; + fluid_atomic_int_set(&midi_driver->autoconnect_is_outdated, FALSE); } /* @@ -708,7 +708,7 @@ fluid_jack_driver_process(jack_nframes_t nframes, void *arg) if(midi_driver) { - if(midi_driver->autoconnect_is_outdated) + if(fluid_atomic_int_get(&midi_driver->autoconnect_is_outdated)) { fluid_jack_midi_autoconnect(client->client, midi_driver); } @@ -820,7 +820,7 @@ fluid_jack_port_registration(jack_port_id_t port, int is_registering, void *arg) if(client_ref->midi_driver != NULL) { - client_ref->midi_driver->autoconnect_is_outdated = client_ref->midi_driver->autoconnect_inputs && is_registering != 0; + fluid_atomic_int_set(&client_ref->midi_driver->autoconnect_is_outdated, client_ref->midi_driver->autoconnect_inputs && is_registering != 0); } } @@ -865,7 +865,7 @@ new_fluid_jack_midi_driver(fluid_settings_t *settings, } fluid_settings_getint(settings, "midi.autoconnect", &dev->autoconnect_inputs); - dev->autoconnect_is_outdated = dev->autoconnect_inputs; + fluid_atomic_int_set(&dev->autoconnect_is_outdated, dev->autoconnect_inputs); dev->client_ref = new_fluid_jack_client(settings, FALSE, dev);