[vlc-commits] demux: ts: add buffer check before parsing PES
Francois Cartegnie
git at videolan.org
Fri Feb 20 20:05:54 CET 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 20 17:25:35 2015 +0100| [e9ef30f85d5f71cec57b15f5f4034a17590478f0] | committer: Francois Cartegnie
demux: ts: add buffer check before parsing PES
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e9ef30f85d5f71cec57b15f5f4034a17590478f0
---
modules/demux/ts.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 9a6a241..daaa0f7 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -2135,7 +2135,13 @@ static void ParsePES( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
mtime_t i_length = 0;
/* FIXME find real max size */
- /* const int i_max = */ block_ChainExtract( p_pes, header, 34 );
+ const int i_max = block_ChainExtract( p_pes, header, 34 );
+ assert(i_max >= 34);
+ if (unlikely(i_max < 34))
+ {
+ block_ChainRelease( p_pes );
+ return;
+ }
if( pid->b_scrambled || header[0] != 0 || header[1] != 0 || header[2] != 1 )
{
More information about the vlc-commits
mailing list