[vlc-commits] demux: mpgv: improve probing
Francois Cartegnie
git at videolan.org
Wed Aug 8 13:49:15 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug 8 11:35:23 2018 +0200| [244951076e10dca80faeda6aa9fd50a4051888b6] | committer: Francois Cartegnie
demux: mpgv: improve probing
need to reject mpeg4 sequences
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=244951076e10dca80faeda6aa9fd50a4051888b6
---
modules/demux/mpeg/mpgv.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/modules/demux/mpeg/mpgv.c b/modules/demux/mpeg/mpgv.c
index 1ab835048d..8e0aea3547 100644
--- a/modules/demux/mpeg/mpgv.c
+++ b/modules/demux/mpeg/mpgv.c
@@ -78,6 +78,26 @@ static void Close( vlc_object_t * p_this )
free( p_sys );
}
+static int CheckMPEGStartCode( const uint8_t *p_peek )
+{
+ switch( p_peek[3] )
+ {
+ case 0x00:
+ if( (p_peek[5] & 0x38) == 0x00 )
+ return VLC_EGENERIC;
+ break;
+ case 0xB0:
+ case 0xB1:
+ case 0xB6:
+ return VLC_EGENERIC;
+ default:
+ if( p_peek[3] > 0xB9 )
+ return VLC_EGENERIC;
+ break;
+ }
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* Open: initializes demux structures
*****************************************************************************/
@@ -91,7 +111,7 @@ static int Open( vlc_object_t * p_this )
es_format_t fmt;
- if( vlc_stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
+ if( vlc_stream_Peek( p_demux->s, &p_peek, 8 ) < 8 )
{
msg_Dbg( p_demux, "cannot peek" );
return VLC_EGENERIC;
@@ -107,12 +127,11 @@ static int Open( vlc_object_t * p_this )
msg_Err( p_demux, "this doesn't look like an MPEG ES stream, continuing" );
}
- if( p_peek[3] > 0xb9 )
+ if( CheckMPEGStartCode( p_peek ) != VLC_SUCCESS )
{
if( !b_forced ) return VLC_EGENERIC;
msg_Err( p_demux, "this seems to be a system stream (PS plug-in ?), but continuing" );
}
-
p_demux->pf_demux = Demux;
p_demux->pf_control= Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
More information about the vlc-commits
mailing list