vaapiupload: fix illegal write in ensure_image().
authorHolger Kaelberer <hk@getslash.de>
Mon, 25 Feb 2013 23:38:24 +0000 (00:38 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 26 Feb 2013 10:27:07 +0000 (11:27 +0100)
commit9bf1ae04ccdc3de04a3c694b573c90266a59bea6
tree718c6a91cfea49333da597140f49a56273672985
parentbd3aa01de5438b736bd37c2ecb154e19fbbce773
vaapiupload: fix illegal write in ensure_image().

Fix ensure_image() to only zero-initialize the first line of each plane.
Properly initializing each plane to their full vertical resolution would
require to actually compute it based on the image format.

In particular, for NV12 images, the UV plane has half vertical resolution
vs. the Y plane. So using the full image height to initialize the UV plane
will obviously lead to a buffer overflow. Likewise for other YUV format.

Since ensure_image() is only a helper function to initialize something,
and not necessarily the whole thing, it is fine to initializ the first
line only. Besides, the target surface is not rendered either.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
gst/vaapi/gstvaapiuploader.c