#724268 alsaplayer-common: Flac plugin crashes with SIGSEGV

Package:
alsaplayer-common
Source:
alsaplayer
Description:
audio player (common files)
Submitter:
Ian Zagorskih
Date:
2013-09-23 05:54:07 UTC
Severity:
normal
#724268#5
Date:
2013-09-23 05:51:44 UTC
From:
To:
Version: 0.99.80-5.1

Dear Maintainer,

Looks like FLAC plugin from alsaplayer-common package has an issue
that leads to crash. Take a look
at the following piece of code from
alsaplayer-0.99.80/input/flac/FlacPlugin.cpp line 125:


static int
flac_open (input_object * obj, const char * name)
{
    .........
    obj->flags = 0;
    Flac::FlacStream * f = 0;
    try
    {
    if (Flac::FlacStream::isFlacStream (name))
    {
        if (reader_seekable (rdr))
        {
        f = new Flac::FlacSeekableStream (name, rdr);
        obj->flags |= P_SEEK | P_PERFECTSEEK;
        }
        else
        f = new Flac::FlacStream (name, rdr);
    }
#ifdef HAVE_LIBOGGFLC
    else
    {
        f = new Flac::OggFlacStream (name, rdr);
    }
#endif
    }
    catch (...)
    {
    alsaplayer_error ("flac_open: unable to allocate memory for plugin.");
    delete f;
    reader_close (rdr);
    return 0;
    }

->  if (f->open ())
    {
    .........
}

If package is built with HAVE_LIBOGGFLC macro undefined and
Flac::FlacStream::isFlacStream(name)
returns false, variable f remains NULL. It is not checked for NULL when
referenced and so player crashes.

I can observe this crash on release 7.1 on some (valid?) flac files course
looks like package is built with
undefined HAVE_LIBOGGFLC macro.

We need to check for f != NULL before it's referenced or take some other
workaround about it. Anyway IMHO
SIGSEGV isn't the best way to handle broken flac files :)

Best regards