mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
rawdec: allocate a buffer in the appropriate size in the copy case.
Otherwise the created buffer can be smaller than buf_size, which results in buffer overreads if the original image has extra padding on every line. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
359af6a7c7
commit
8962da9ec3
@ -190,7 +190,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
return res;
|
||||
|
||||
if (need_copy)
|
||||
frame->buf[0] = av_buffer_alloc(context->frame_size);
|
||||
frame->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, buf_size));
|
||||
else
|
||||
frame->buf[0] = av_buffer_ref(avpkt->buf);
|
||||
if (!frame->buf[0])
|
||||
@ -219,7 +219,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
}
|
||||
buf = dst;
|
||||
} else if (need_copy) {
|
||||
memcpy(frame->buf[0]->data, buf, FFMIN(buf_size, context->frame_size));
|
||||
memcpy(frame->buf[0]->data, buf, buf_size);
|
||||
buf = frame->buf[0]->data;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user