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

Ivan Kalvachev ikalvachev at gmail.com
Mon Oct 9 03:04:53 EEST 2017


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.

BTW,
I have no idea why the new fields haven't simply been added to the
existing struct...
It seems that the programmer who wrote this has been aware of the problem,
because av_vdpau_bind_context reallocates the structure.

It might be good idea to check the other usages of this reallocation function.

Best Regards
   Ivan Kalvachev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-crash-if-av_vdpau_bind_context-is-not-used.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171009/95db86f9/attachment.bin>


More information about the ffmpeg-devel mailing list