summaryrefslogtreecommitdiff
path: root/libavcodec/vdpau.c
diff options
context:
space:
mode:
authorIvan Kalvachev <ikalvachev@gmail.com>2017-10-09 02:40:26 +0300
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2017-10-13 00:13:17 +0200
commit3a6ded7cfcb33e06ade98c5791eae06453f65668 (patch)
tree711941290093aefe084dde9d116c368c19c731e0 /libavcodec/vdpau.c
parentc87bb9c04af804e2cd6a18110780ffb6d85109e3 (diff)
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>
Diffstat (limited to 'libavcodec/vdpau.c')
-rw-r--r--libavcodec/vdpau.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 42ebddbeee..4cc51cb79e 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -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,