vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Jul 26 14:12:27 2015 +0300| [8df23063edb12ad61b693322e33ea9c59aad875b] | committer: 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. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8df23063edb12ad61b693322e33ea9c59aad875b --- modules/access/archive/stream.c | 2 ++ modules/access/rar/rar.c | 5 ++++- modules/access/zip/zipstream.c | 2 ++ modules/demux/image.c | 3 +++ modules/stream_filter/hds/hds.c | 2 +- modules/stream_filter/smooth/smooth.c | 2 +- src/input/stream_demux.c | 3 +-- src/input/stream_filter.c | 12 +++++++----- src/input/stream_memory.c | 3 +-- 9 files changed, 22 insertions(+), 12 deletions(-) diff --git a/modules/access/archive/stream.c b/modules/access/archive/stream.c index 8eb0607..4fa1a64 100644 --- a/modules/access/archive/stream.c +++ b/modules/access/archive/stream.c @@ -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 ) diff --git a/modules/access/rar/rar.c b/modules/access/rar/rar.c index 6ef343a..009e4ed 100644 --- a/modules/access/rar/rar.c +++ b/modules/access/rar/rar.c @@ -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 (;;) { diff --git a/modules/access/zip/zipstream.c b/modules/access/zip/zipstream.c index 72aeb5f..88d1e53 100644 --- a/modules/access/zip/zipstream.c +++ b/modules/access/zip/zipstream.c @@ -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 ) diff --git a/modules/demux/image.c b/modules/demux/image.c index 5b96605..3676057 100644 --- a/modules/demux/image.c +++ b/modules/demux/image.c @@ -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; diff --git a/modules/stream_filter/hds/hds.c b/modules/stream_filter/hds/hds.c index 8f0f21a..98074a4 100644 --- a/modules/stream_filter/hds/hds.c +++ b/modules/stream_filter/hds/hds.c @@ -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 ); diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c index dfac375..6faa4a1 100644 --- a/modules/stream_filter/smooth/smooth.c +++ b/modules/stream_filter/smooth/smooth.c @@ -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 ); diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c index e122cbc..21df46b 100644 --- a/src/input/stream_demux.c +++ b/src/input/stream_demux.c @@ -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 ); diff --git a/src/input/stream_filter.c b/src/input/stream_filter.c index 5cb57f7..0e3cf4b 100644 --- a/src/input/stream_filter.c +++ b/src/input/stream_filter.c @@ -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; diff --git a/src/input/stream_memory.c b/src/input/stream_memory.c index 219a155..eb6e6f3 100644 --- a/src/input/stream_memory.c +++ b/src/input/stream_memory.c @@ -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 ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
