ref: d286fe436eb2725df329da508bb3c1b7caeed875
parent: d013a9358f7f1a49b13ef854c7f020c5b05a0933
author: Paul Brossier <piem@piem.org>
date: Mon Dec 17 18:00:02 EST 2018
[io] prevent crash in sink on null path
--- a/src/io/sink.c
+++ b/src/io/sink.c
@@ -93,6 +93,7 @@
static const char_t *aubio_get_extension(const char_t *filename)
{
+ if (!filename) return NULL;
// find last occurence of dot character
const char_t *ext = strrchr(filename, '.');
if (!ext || ext == filename) return "";
@@ -108,7 +109,7 @@
#ifdef HAVE_VORBISENC
// check if this uri could be for us
uint_t match_oggstream = 0;
- if (strcmp (uri_ext, "ogg") == 0) match_oggstream = 1;
+ if (uri_ext && strcmp (uri_ext, "ogg") == 0) match_oggstream = 1;
if (match_oggstream) {
s->sink = (void *)new_aubio_sink_vorbis(uri, samplerate);
if (s->sink) {
@@ -128,7 +129,7 @@
#ifdef HAVE_FLAC
// check if this uri could be for us
uint_t match_flacstream = 0;
- if (strcmp (uri_ext, "flac") == 0) match_flacstream = 1;
+ if (uri_ext && strcmp (uri_ext, "flac") == 0) match_flacstream = 1;
if (match_flacstream) {
s->sink = (void *)new_aubio_sink_flac(uri, samplerate);
if (s->sink) {