Update fluidsynth
authorRobin Gareus <robin@gareus.org>
Tue, 27 Jun 2017 18:12:03 +0000 (20:12 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 27 Jun 2017 18:12:46 +0000 (20:12 +0200)
Fix potential crashes in case fluid-synth runs into an OOM error,
and address a const-cast compiler warning.

Switch to track github repo (instead of sf.net git)

libs/fluidsynth/src/fluid_midi.c
libs/fluidsynth/src/fluid_settings.c
libs/fluidsynth/src/fluid_settings.h
libs/fluidsynth/src/fluid_synth.c
tools/update_fluidsynth.sh

index 171952fcaef6e0e7192d155d2ba023e558e2107a..fc58d839efb099d4364983bbf73bc028de20bdac 100644 (file)
@@ -372,10 +372,17 @@ fluid_midi_file_read_track(fluid_midi_file *mf, fluid_player_t *player, int num)
             }
 
             /* Skip remaining track data, if any */
-            if (mf->trackpos < mf->tracklen)
-                fluid_midi_file_skip(mf, mf->tracklen - mf->trackpos);
+            if (mf->trackpos < mf->tracklen) {
+                if (fluid_midi_file_skip(mf, mf->tracklen - mf->trackpos) != FLUID_OK) {
+                    delete_fluid_track(track);
+                    return FLUID_FAILED;
+                }
+            }
 
-            fluid_player_add_track(player, track);
+            if (fluid_player_add_track(player, track) != FLUID_OK) {
+                delete_fluid_track(track);
+                return FLUID_FAILED;
+            }
 
         } else {
             found_track = 0;
index 56de8c71d7ac8896a3927c6130aeac81e66e8fea..181484ecc3e252c17c4bb11a7b48a8dece637a8d 100644 (file)
@@ -443,7 +443,7 @@ fluid_settings_set(fluid_settings_t* settings, const char *name, void* value)
 /** returns 1 if the value has been registered correctly, 0
     otherwise */
 int
-fluid_settings_register_str(fluid_settings_t* settings, char* name, char* def, int hints,
+fluid_settings_register_str(fluid_settings_t* settings, const char* name, const char* def, int hints,
                            fluid_str_update_t fun, void* data)
 {
   fluid_setting_node_t *node;
index 0eb1f9728649fba661c2b326c7c40a84b58c94d2..244f0b457b3198712335574f3daeab2739cbd796 100644 (file)
@@ -37,7 +37,7 @@ typedef int (*fluid_int_update_t)(void* data, const char* name, int value);
 
 /** returns 0 if the value has been registered correctly, non-zero
     otherwise */
-int fluid_settings_register_str(fluid_settings_t* settings, char* name, char* def, int hints,
+int fluid_settings_register_str(fluid_settings_t* settings, const char* name, const char* def, int hints,
                               fluid_str_update_t fun, void* data);
 
 /** returns 0 if the value has been registered correctly, non-zero
index a12260c7b073eb4024583d647cddb7c2016c0ab3..8a30e250ba3953d2d6ac6fdc84884af0f8d17c11 100644 (file)
@@ -2544,6 +2544,12 @@ fluid_synth_process(fluid_synth_t* synth, int len, int nin, float** in,
     int i;
     left = FLUID_ARRAY(float*, nout/2);
     right = FLUID_ARRAY(float*, nout/2);
+    if ((left == NULL) || (right == NULL)) {
+      FLUID_LOG(FLUID_ERR, "Out of memory.");
+      FLUID_FREE(left);
+      FLUID_FREE(right);
+      return FLUID_FAILED;
+    }
     for(i=0; i<nout/2; i++) {
       left[i] = out[2*i];
       right[i] = out[2*i+1];
index 66ad7835fab877a299007d414a1ef409224f09f5..785d68bc0fedf510e833f67c4b477b3eaf4c5d38 100755 (executable)
@@ -20,7 +20,8 @@ echo $TMP
 trap "rm -rf $TMP" EXIT
 
 cd $TMP
-git clone git://git.code.sf.net/p/fluidsynth/code-git fs-git
+#git clone git://git.code.sf.net/p/fluidsynth/code-git fs-git
+git clone git://github.com/FluidSynth/fluidsynth.git fs-git
 
 FSR=fs-git/fluidsynth/