Commit 4e6d1c1f authored by Philip Langdale's avatar Philip Langdale

avcodec/vdpau_hevc: Fix potential out-of-bounds write

The maximum number of references is 16, so the index value cannot
exceed 15.

Fixes Coverity CID 1348139, 1348140, 1348141
parent 5512dbe3
...@@ -234,7 +234,7 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx, ...@@ -234,7 +234,7 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
const HEVCFrame *frame = &h->DPB[i]; const HEVCFrame *frame = &h->DPB[i];
if (frame != h->ref && (frame->flags & (HEVC_FRAME_FLAG_LONG_REF | if (frame != h->ref && (frame->flags & (HEVC_FRAME_FLAG_LONG_REF |
HEVC_FRAME_FLAG_SHORT_REF))) { HEVC_FRAME_FLAG_SHORT_REF))) {
if (j > 16) { if (j > 15) {
av_log(avctx, AV_LOG_WARNING, av_log(avctx, AV_LOG_WARNING,
"VDPAU only supports up to 16 references in the DPB. " "VDPAU only supports up to 16 references in the DPB. "
"This frame may not be decoded correctly.\n"); "This frame may not be decoded correctly.\n");
......
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