Commit b0b90100 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avcodec/libopenh264dec: Increase array sizes, fix stack-buffer overread

av_image_copy() expects an array of four pointers and linesizes
according to its declaration; it currently only pointers that are
actually in use (depending upon the pixel format), but this might
change at any time. It has already happened for the linesizes in
d7bc52bf and so increasing their
array fixes a stack-buffer overread.

This fixes a -Wstringop-overflow= and -Wstringop-overread warning
from GCC 11.2.
Reviewed-by: 's avatarLinjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
parent ef00d40e
......@@ -91,8 +91,8 @@ static int svc_decode_frame(AVCodecContext *avctx, void *data,
{
SVCContext *s = avctx->priv_data;
SBufferInfo info = { 0 };
uint8_t* ptrs[3];
int ret, linesize[3];
uint8_t *ptrs[4] = { NULL };
int ret, linesize[4];
AVFrame *avframe = data;
DECODING_STATE state;
#if OPENH264_VER_AT_LEAST(1, 7)
......@@ -140,6 +140,7 @@ static int svc_decode_frame(AVCodecContext *avctx, void *data,
linesize[0] = info.UsrData.sSystemBuffer.iStride[0];
linesize[1] = linesize[2] = info.UsrData.sSystemBuffer.iStride[1];
linesize[3] = 0;
av_image_copy(avframe->data, avframe->linesize, (const uint8_t **) ptrs, linesize, avctx->pix_fmt, avctx->width, avctx->height);
avframe->pts = info.uiOutYuvTimeStamp;
......
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