libs: context: use attribs index instead pointers
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 8 Aug 2017 16:52:37 +0000 (18:52 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 8 Aug 2017 16:52:37 +0000 (18:52 +0200)
commite42ec3ad3c5dfcc9ae6826b6b215b8d6efd856ab
tree2006bff0e7d8b184e2b327f6da3fcc1245d5ef3b
parent9578fd1f7b49b8d6c0dbdd02673814eaf8099aa1
libs: context: use attribs index instead pointers

Coverity scan bug:

Out-of-bounds write. This could cause an immediate crash or incorrect
computations.

Coverity basically found that it is possible to assign more than 4
attribs in the array.

In my opinion this was produced because code pattern used pointer
arithmetic, which is not readable nor maintainable.

This patch refactors config_create() to use an array index rather than
pointer arithmetic. Also a run-time check for index size was added.
gst-libs/gst/vaapi/gstvaapicontext.c