1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

hevcdec: do not set decoder-global SPS prematurely

It should only be set after the decoder state has been fully initialized
for using that SPS.
Fixes possible invalid reads on get_format() failure.

CC: libav-stable@libav.org
This commit is contained in:
Anton Khirnov 2016-12-18 22:06:32 +01:00
parent 0fea8555ae
commit 373fd76b4d

View File

@ -479,17 +479,16 @@ static int hls_slice_header(HEVCContext *s)
s->ps.pps = (HEVCPPS*)s->ps.pps_list[sh->pps_id]->data;
if (s->ps.sps != (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) {
const HEVCSPS *sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data;
enum AVPixelFormat pix_fmt;
s->ps.sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data;
ff_hevc_clear_refs(s);
pix_fmt = get_format(s, s->ps.sps);
pix_fmt = get_format(s, sps);
if (pix_fmt < 0)
return pix_fmt;
ret = set_sps(s, s->ps.sps, pix_fmt);
ret = set_sps(s, sps, pix_fmt);
if (ret < 0)
return ret;