[FFmpeg-cvslog] Fix crash if av_vdpau_bind_context() is not used.

Ivan Kalvachev git at videolan.org
Fri Oct 13 01:13:36 EEST 2017


ffmpeg | branch: master | Ivan Kalvachev <ikalvachev at gmail.com> | Mon Oct  9 02:40:26 2017 +0300| [3a6ded7cfcb33e06ade98c5791eae06453f65668] | committer: Carl Eugen Hoyos

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a6ded7cfcb33e06ade98c5791eae06453f65668
---

 libavcodec/vdpau.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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,



More information about the ffmpeg-cvslog mailing list