Commit 8df23063 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: allow NULL psz_url and fail as appropriate

Previously, "" would be used, leading to nonsensical results in those
stream filters that actually need a URL.
parent c6274d04
......@@ -169,6 +169,8 @@ int StreamOpen(vlc_object_t *p_object)
if (!ProbeArchiveFormat(p_stream->p_source))
return VLC_EGENERIC;
if (p_stream->psz_url == NULL)
return VLC_EGENERIC;
p_stream->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
if( !p_sys )
......
......@@ -317,12 +317,15 @@ int RarParse(stream_t *s, int *count, rar_file_t ***file, unsigned int *pi_nbvol
*file = NULL;
*pi_nbvols = 1;
if( s->psz_url == NULL )
return VLC_EGENERIC;
const rar_pattern_t *pattern = FindVolumePattern(s->psz_url, b_extonly);
int volume_offset = 0;
char *volume_mrl = strdup(s->psz_url);
if (volume_mrl == NULL)
return VLC_EGENERIC;
return VLC_ENOMEM;
stream_t *vol = s;
for (;;) {
......
......@@ -177,6 +177,8 @@ int StreamOpen( vlc_object_t *p_this )
return VLC_EGENERIC;
if( memcmp( p_peek, p_zip_marker, i_zip_marker ) )
return VLC_EGENERIC;
if( s->psz_url == NULL )
return VLC_EGENERIC;
s->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
if( !p_sys )
......
......@@ -437,6 +437,9 @@ static bool FindSVGmarker(int *position, const uint8_t *data, const int size, co
static bool IsSVG(stream_t *s)
{
if (s->psz_url == NULL)
return false;
char *ext = strstr(s->psz_url, ".svg");
if (!ext) return false;
......
......@@ -1628,7 +1628,7 @@ static int Open( vlc_object_t *p_this )
stream_t *s = (stream_t*)p_this;
stream_sys_t *p_sys;
if( !isHDS( s ) )
if( !isHDS( s ) || s->psz_url == NULL )
return VLC_EGENERIC;
msg_Info( p_this, "HTTP Dynamic Streaming (%s)", s->psz_url );
......
......@@ -459,7 +459,7 @@ static int Open( vlc_object_t *p_this )
stream_t *s = (stream_t*)p_this;
stream_sys_t *p_sys;
if( !isSmoothStreaming( s ) )
if( !isSmoothStreaming( s ) || s->psz_url == NULL )
return VLC_EGENERIC;
msg_Info( p_this, "Smooth Streaming (%s)", s->psz_url );
......
......@@ -74,13 +74,12 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
if( s == NULL )
return NULL;
s->p_input = p_demux->p_input;
s->psz_url = strdup(""); /* N/A */
s->pf_read = DStreamRead;
s->pf_control= DStreamControl;
s->pf_destroy= DStreamDelete;
s->p_sys = p_sys = malloc( sizeof( *p_sys) );
if( !s->psz_url || !s->p_sys )
if( !s->p_sys )
{
free( p_sys );
stream_CommonDelete( s );
......
......@@ -48,12 +48,14 @@ stream_t *stream_FilterNew( stream_t *p_source,
s->p_input = p_source->p_input;
/* */
s->psz_url = strdup( p_source->psz_url );
if( unlikely(s->psz_url == NULL) )
if( s->psz_url != NULL )
{
stream_CommonDelete( s );
return NULL;
s->psz_url = strdup( p_source->psz_url );
if( unlikely(s->psz_url == NULL) )
{
stream_CommonDelete( s );
return NULL;
}
}
s->p_source = p_source;
......
......@@ -59,9 +59,8 @@ stream_t *stream_MemoryNew( vlc_object_t *p_this, uint8_t *p_buffer,
if( !s )
return NULL;
s->psz_url = strdup( "" ); /* N/A */
s->p_sys = p_sys = malloc( sizeof( stream_sys_t ) );
if( !s->psz_url || !s->p_sys )
if( !s->p_sys )
{
stream_CommonDelete( s );
free( p_sys );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment