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

dvdnav: ps_pkt_size() requires at least 6 bytes (fixes #4015)

The same check is already done in the dvdread, ps and vobsub modules.
parent 6fb07d77
...@@ -1129,17 +1129,17 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *pkt, int i_pkt ) ...@@ -1129,17 +1129,17 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *pkt, int i_pkt )
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
const uint8_t *p = pkt; const uint8_t *p = pkt;
while( p < &pkt[i_pkt] ) while( (p - pkt) <= (i_pkt - 6) )
{ {
/* ps_pkt_size() needs at least 6 bytes */
int i_size = ps_pkt_size( p, &pkt[i_pkt] - p ); int i_size = ps_pkt_size( p, &pkt[i_pkt] - p );
block_t *p_pkt;
if( i_size <= 0 ) if( i_size <= 0 )
{ {
break; break;
} }
/* Create a block */ /* Create a block */
p_pkt = block_New( p_demux, i_size ); block_t *p_pkt = block_New( p_demux, i_size );
memcpy( p_pkt->p_buffer, p, i_size); memcpy( p_pkt->p_buffer, p, i_size);
/* Parse it and send it */ /* Parse it and send it */
......
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