Commit 7c1455d6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

hevc: fix potential use-after-free

GatherAndValidate() can free the fragment. Extract the timestamps earlier.
parent 9d735159
......@@ -781,8 +781,10 @@ static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_fra
}
/* Get NALU type */
const mtime_t dts = p_frag->i_dts, pts = p_frag->i_pts;
block_t * p_output = NULL;
uint8_t i_nal_type = hevc_getNALType(&p_frag->p_buffer[4]);
if (i_nal_type < HEVC_NAL_VPS)
{
/* NAL is a VCL NAL */
......@@ -799,9 +801,9 @@ static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_fra
if(p_output)
{
SetOutputBlockProperties( p_dec, p_output );
if(p_frag->i_dts > VLC_TS_INVALID)
date_Set(&p_sys->dts, p_frag->i_dts);
p_sys->pts = p_frag->i_pts;
if (dts > VLC_TS_INVALID)
date_Set(&p_sys->dts, dts);
p_sys->pts = pts;
*pb_ts_used = true;
}
......
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