codec: decode struct from encoded array should stay within length of encoded array.