# std.compress.zstandard: add error condition to ring buffer decoding · gitcafe/zig

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

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

Visibility: public

Requested revision: a53cf299a6a22422d734d54b6abed4ff8b6473c5

Requested commit: a53cf299a6a22422d734d54b6abed4ff8b6473c5

Commit: a53cf299a6a22422d734d54b6abed4ff8b6473c5

Tree: 5b432d404112e31fe32aca2f830811498c6ef4a3

Author: dweiller

Committer: dweiller

## Message

```
std.compress.zstandard: add error condition to ring buffer decoding

Previously `executeSequenceRingBuffer()` would not verify the offset
against the number of bytes already decoded, so it would happily copy
garbage bytes rather than return an error before the window was filled.

To fix this a new `written_count` is added to the decode state that
tracks the total number of bytes decoded.

```

## Parents

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

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