Do not reserve memory for the bucket count read from a time series state
The number of buckets is read from the serialized state and was only checked against the bucket count derived from the function parameters. A huge window makes that count enormous, so a tiny state could ask for an arbitrarily large allocation: an 18-byte state of `timeSeriesChangesToGrid` allocated 1.25 GiB. Only a bounded number of buckets is reserved now and the map grows while the buckets are read.
V
Vitaly Baranov committed
e908ac18af60e0e2646f49c404905acac71de56f
Parent: e39061f