Commit 37dbfdd2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

dvdnav: fix potential buffer read overflow

(cherry picked from commit d626e678)

Conflicts:

	modules/access/dvdnav.c
parent 0e80686f
...@@ -1136,16 +1136,14 @@ static void ESSubtitleUpdate( demux_t *p_demux ) ...@@ -1136,16 +1136,14 @@ static void ESSubtitleUpdate( demux_t *p_demux )
/***************************************************************************** /*****************************************************************************
* DemuxBlock: demux a given block * DemuxBlock: demux a given block
*****************************************************************************/ *****************************************************************************/
static int DemuxBlock( demux_t *p_demux, const uint8_t *pkt, int i_pkt ) static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
const uint8_t *p = pkt;
while( (p - pkt) <= (i_pkt - 6) ) while( len > 0 )
{ {
/* ps_pkt_size() needs at least 6 bytes */ int i_size = ps_pkt_size( p, len );
int i_size = ps_pkt_size( p, &pkt[i_pkt] - p ); if( i_size <= 0 || i_size > len )
if( i_size <= 0 )
{ {
break; break;
} }
...@@ -1215,6 +1213,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *pkt, int i_pkt ) ...@@ -1215,6 +1213,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *pkt, int i_pkt )
} }
p += i_size; p += i_size;
len -= i_size;
} }
return VLC_SUCCESS; return VLC_SUCCESS;
......
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