# Sema: fix UAF in zirClosureGet · gitcafe/zig

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

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

Visibility: public

Requested revision: 99826a2ba89ccd80caaa4eeb47c59a71ddfe76b6

Requested commit: 99826a2ba89ccd80caaa4eeb47c59a71ddfe76b6

Commit: 99826a2ba89ccd80caaa4eeb47c59a71ddfe76b6

Tree: 1e769aff2edca88474f60f28846da7a4a62e18f0

Author: Veikka Tuominen

Committer: Veikka Tuominen

## Message

```
Sema: fix UAF in zirClosureGet

Previously if a decl failed its capture scope would be deallocated and
set to undefined which would then lead to invalid dereference in
`zirClosureGet`. To avoid this set the capture scope to a special
failed state and fail the current decl with dependency failure if
the failed state is encountered in `zirClosureGet`.

Closes #12433
Closes #12530
Closes #12593

```

## Parents

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

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