Here is a report of a queue of size 1000 crashing trying to access index 1020 during dequeueing: https://github.com/deltachat/deltachat-core-rust/issues/2442
Edit: I posted a "testcase" here previously, but actually it does not reproduce the problem