See [here](https://github.com/rust-lang/miri/pull/3712#pullrequestreview-2243021331) for the relevant code and what is wrong with it: we first fetch an event from the queue, and then try to find a spot for it in the buffer. That's the wrong way around; we should iterate over the output buffer and only if we are sure we can store an event, then fetch one from the queue. Cc @tiif