Fixes infinite loop in DecodeStream_ensureBuffer()

Fixes an infinite loop if requested size is > 2^30, see #3928