1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Fix crash if av_vdpau_bind_context() is not used.

The public functions av_alloc_vdpaucontext() and
av_vdpau_alloc_context() are allocating AVVDPAUContext
structure that is supposed to be placed in avctx->hwaccel_context.

However the rest of libavcodec/vdpau.c uses avctx->hwaccel_context
as struct VDPAUHWContext, that is bigger and does contain
AVVDPAUContext as first member.

The usage includes write to the new variables in the bigger stuct,
without checking for block size.

Fix by always allocating the bigger structure.

Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
This commit is contained in:
Ivan Kalvachev 2017-10-09 02:40:26 +03:00 committed by Carl Eugen Hoyos
parent c87bb9c04a
commit 3a6ded7cfc

View File

@ -816,7 +816,7 @@ do { \
AVVDPAUContext *av_vdpau_alloc_context(void)
{
return av_mallocz(sizeof(AVVDPAUContext));
return av_mallocz(sizeof(VDPAUHWContext));
}
int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,