shithub: aubio

Download patch

ref: e83c8957b6f162f52ee162576253d539531b1fe5
parent: 5cc94db5778fb51283c26896d197009462b6db36
author: Paul Brossier <[email protected]>
date: Wed May 17 05:12:44 EDT 2006

strange workaround to fix segfaults on some wav files
strange workaround to fix segfaults on some wav files


--- a/ext/sndfileio.c
+++ b/ext/sndfileio.c
@@ -42,8 +42,11 @@
         aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t);
         SF_INFO sfinfo;
         AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
+        sfinfo.format = 0;
 
-        if (! (f->handle = sf_open (outputname, SFM_READ, &sfinfo))) {
+        f->handle = sf_open (outputname, SFM_READ, &sfinfo);
+
+        if (f->handle == NULL) {
                 AUBIO_ERR("Unable to open input file %s.\n", outputname);
                 AUBIO_ERR("%s\n",sf_strerror (NULL)); /* libsndfile err msg */
                 return NULL;
@@ -66,7 +69,7 @@
 
 int aubio_sndfile_open_wo(aubio_sndfile_t * f, const char* inputname) {
         SF_INFO sfinfo;
-        memset (&sfinfo, 0, sizeof (sfinfo));
+        AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
 
         /* define file output spec */
         sfinfo.samplerate = f->samplerate;