Skip to content

validate dynamic arrays of size 0

Chia-I Wu requested to merge zero-size into master

We always encode the array size (i.e., vn_encode_array_size) for arrays. But for dynamic arrays, where `len="fooCount"' attribute is specified in vk.xml, fooCount specifies the array size as well.

In commit 9c3019ee ("make vn_decode_array_size validate strictly"), we make sure vn_decode_array_size validate that the two sizes match, except for when the dynamic array pointers are NULL. This commit fixes that.

In VkVariable::is_optional, we no longer treat dynamic arrays as optional blindly. In Gen::_decode_variable, we make sure vn_decode_array_size validates or we call vn_decode_array_size_unchecked when we cannot validate.

/cc @zzyiwei @ryanneph

Merge request reports