vkr: validate array sizes and string lengths

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.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
22 files changed