Skip to content

vkr: validate array sizes and string lengths

Chia-I Wu requested to merge olv/virglrenderer:vkr-validate into master

This is generated from https://gitlab.freedesktop.org/olv/venus-protocol/-/merge_requests/17.

For a (fooCount, pFoo) array, we encode fooCount twice. Previously, we used one for allocation and the other for initialization. When the two differed, we could allocate an array of N elements but initialize only the first M elements. We only validated that M <= N.

After this commit, vn_decode_array_size validates that M == N.

The other main change is that this commit adds vn_decode_char_array to make sure strings are null-terminated.

/cc @zzyiwei @ryanneph

Merge request reports