VST3 wrapper assumes IBStream is a MemoryStream, may crash

Investigating weird crashes loading settings for various VST3 plugins in FL Studio, I came across the setState() function in juce_VST3_Wrapper.cpp. In an earlier version it always assumed that the state object was a MemoryStream, but I see this is no longer the case when the host is FL.

However, this still assumes that it’s a MemoryStream for any other host, which may or may not be the case. Or to put it differently, the sdk guarantees nothing more than that state will be an IBStream. If it works with a cast to MemoryStream, then that’s a pure coincidence. Note that it also will not work properly if the host detection ever fails (for example: FL on macOS will currently not be detected).

Is there a reason not to just use readFromUnknownStream() in all cases? I guess this involves an extra copy operation and higher memory use, but the alternative is that it crashes without a clear indication of the cause (and users may lose data).