# \[priority_dequeue\] Fix out-of-bounds access · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/82470d4f892af2efa64acd58ab3188fa917ace0c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 82470d4f892af2efa64acd58ab3188fa917ace0c

Requested commit: 82470d4f892af2efa64acd58ab3188fa917ace0c

Commit: 82470d4f892af2efa64acd58ab3188fa917ace0c

Tree: 86fc03ba6899051e78a57d3c3ebdb3004ea5044f

Author: Niles Salter

Committer: Andrew Kelley

## Message

```
[priority_dequeue] Fix out-of-bounds access

This makes it so `first_child_index` will not be accessed when it is equal to `self.len`. (i.e. `self.items[self.len]` will not happen) The access itself was "safe" (as in, `self.len < self.items.len`) because we were only calling `doSiftDown` in the case where there was a stale value at `self.items[self.len]`. However, it is still technically a bug, and can manifest by an unnecessary comparison of a value to a copy of itself.
```

## Parents

- [ff5850183eee854fdfe0d3f7b7242b9ff56c2116](https://git.cafe/gitcafe/zig/commit/ff5850183eee854fdfe0d3f7b7242b9ff56c2116?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/82470d4f892af2efa64acd58ab3188fa917ace0c?format=markdown)
