# zstd.Decompress.stream: Fix handling of skippable frames in new_frame state · gitcafe/zig

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

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

Visibility: public

Requested revision: 08f0780cb2e33ae4d1f7059b6f173459b46adc25

Requested commit: 08f0780cb2e33ae4d1f7059b6f173459b46adc25

Commit: 08f0780cb2e33ae4d1f7059b6f173459b46adc25

Tree: e5428115a5ebb4afb1979289b0060b2cafcc512b

Author: Ryan Liptak

Committer: Andrew Kelley

## Message

```
zstd.Decompress.stream: Fix handling of skippable frames in new_frame state

The previous code assumed that `initFrame` during the `new_frame` state would always result in the `in_frame` state, but that's not always the case. `initFrame` can also result in the `skippable_frame` state, which would lead to access of union field 'in_frame' while field 'skipping_frame' is active.

Now, the switch is re-entered with the updated state so either case is handled appropriately.

Fixes the crashes from https://github.com/ziglang/zig/issues/24817

```

## Parents

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

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