# link.Elf: fix UAF in lowerAnonDecl · gitcafe/zig

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

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

Visibility: public

Requested revision: 098a07dc45b678af22bb47379e75371767385cbf

Requested commit: 098a07dc45b678af22bb47379e75371767385cbf

Commit: 098a07dc45b678af22bb47379e75371767385cbf

Tree: 6e5427e597fc5230b8448ce8a440dc29c4e00fc2

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
link.Elf: fix UAF in lowerAnonDecl

The main problem being fixed here is there was a getOrPut() that held on
to a reference to the value pointer too long, and meanwhile the call to
`lowerConst` ended up being recursive and mutating the hash map,
invoking undefined behavior.

caught via #17719

```

## Parents

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

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