read Array Length
Reads the element count of a variable-length XDR array and validates it against the remaining bytes before the caller allocates the array.
Every XDR array element occupies at least 4 bytes (scalars, enum and union discriminants, optional flags and length prefixes are 4 bytes; fixed opaque data is padded to 4), so a count above a quarter of the remaining bytes cannot be satisfied by the buffer. Rejecting it here keeps a hostile count from sizing a large allocation.
Return
The element count, between 0 and a quarter of the remaining bytes (inclusive).
Throws
if the count is negative or exceeds a quarter of the remaining bytes.