]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11496: [core] fix crash with four channel sound file
authorBrian West <brian@freeswitch.org>
Tue, 6 Nov 2018 14:40:11 +0000 (08:40 -0600)
committerMike Jerris <mike@signalwire.com>
Thu, 6 Jun 2019 15:13:06 +0000 (11:13 -0400)
src/switch_core_file.c
src/switch_ivr_play_say.c

index 7db2dd92dea5dde0e6a9e97493c518698068f9fb..ca5a3402140a895d45044042acbc1229f661e197 100644 (file)
@@ -404,6 +404,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 
 
        if (fh->real_channels != fh->channels && (flags & SWITCH_FILE_FLAG_READ) && !(fh->flags & SWITCH_FILE_NOMUX)) {
+               fh->cur_channels = fh->real_channels;
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File has %d channels, muxing to %d channel%s will occur.\n", fh->real_channels, fh->channels, fh->channels == 1 ? "" : "s");
        }
 
index 85e8d974c5129daa92a6f553547fd4ff0ab2ba7d..35fed600cb62f24ca09c62c57754d6218e87f503 100644 (file)
@@ -1664,7 +1664,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                }
                        }
 
-                       buflen = (FILE_STARTSAMPLES * sizeof(*abuf) * fh->cur_channels) > 0 ? fh->cur_channels : fh->channels;
+                       buflen = FILE_STARTSAMPLES * sizeof(*abuf) * (fh->cur_channels > 0 ? fh->cur_channels : fh->channels); 
 
                        if (buflen > write_frame.buflen) {
                                abuf = realloc(abuf, buflen);