[vlc-devel] Re: play "dvd://" crashes

Brian Robb vascy at hotmail.com
Sun Sep 4 21:48:05 CEST 2005


If you try:

"dvd://" as the address vlc crashes.

It'll crash if you do:
vlc dvd://

Via the command line...

And it'll crash if you goto File->Open Disc and leave the Device name blank.

The fix for it is in src/extras/libc.c to change:

size_t vlc_iconv( vlc_iconv_t cd, char **inbuf, size_t *inbytesleft,
                  char **outbuf, size_t *outbytesleft )
{
#if defined(HAVE_ICONV)
    return iconv( cd, inbuf, inbytesleft, outbuf, outbytesleft );
#else
    int i_bytes = __MIN(*inbytesleft, *outbytesleft);
    if( !inbuf || !outbuf || !i_bytes ) return (size_t)(-1);
    memcpy( *outbuf, *inbuf, i_bytes );
    inbuf += i_bytes;
    outbuf += i_bytes;
    inbytesleft -= i_bytes;
    outbytesleft -= i_bytes;
    return i_bytes;
#endif
}

To:

size_t vlc_iconv( vlc_iconv_t cd, char **inbuf, size_t *inbytesleft,
                  char **outbuf, size_t *outbytesleft )
{
#if defined(HAVE_ICONV)
    return iconv( cd, inbuf, inbytesleft, outbuf, outbytesleft );
#else
    int i_bytes;

    if (inbytesleft == NULL || outbytesleft == NULL) {
        return 0;
    }

    i_bytes = __MIN(*inbytesleft, *outbytesleft);
    if( !inbuf || !outbuf || !i_bytes ) return (size_t)(-1);
    memcpy( *outbuf, *inbuf, i_bytes );
    inbuf += i_bytes;
    outbuf += i_bytes;
    inbytesleft -= i_bytes;
    outbytesleft -= i_bytes;
    return i_bytes;
#endif
}

It's because if: inbytesleft or outbytesleft is NULL,
then *inbytesleft or *outbytesleft will essentially be a random number.

:)


-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list