I suggest a function, which returns the size a Statechunk would have, if I would get it, as NeedBig in C++ needs this information.
Otherwise, large StateChunks could be truncated, what happened to nofish in this thread:
https://forum.cockos.com/showthread.php?t=221575
Alternatively, the GetXXXStateChunk functions return false, if the NeedBig wasn't big enough.