Description
PlatformOutputStreamImpl.unsafeEnsure causes integer overflow, then passes a negative value to PlatformCallbackGateway.memoryReallocate from there it is passed to Marshal.ReAllocHGlobal, which throws an OutOfMemoryException.
Reproducer:
var val = new byte[100_000_000]; var ignite = Ignition.Start(); var cache = ignite.CreateCache<int, byte[]>("c"); for (int i = 0; i < 30; i++) // ~3GB of cache data cache[i] = val; cache.Query(new ScanQuery<int, byte[]>()).GetAll();
We should handle this condition gracefully: detect stream size limit and throw an exception explaining how to fix the problem (use smaller pageSize for queries, for example).