# libc malloc: introduce a canary · gitcafe/zig

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

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

Visibility: public

Requested revision: 017228de89ef2ea4ed229c4eea62317826a909b6

Requested commit: 017228de89ef2ea4ed229c4eea62317826a909b6

Commit: 017228de89ef2ea4ed229c4eea62317826a909b6

Tree: ee1b68e5f86a35217e0258351e7b9ac6505206c0

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
libc malloc: introduce a canary

Instead of padding, use static entropy to detect corrupted header.

* 64-bit, safe modes: 10 canary bits
* 64-bit, unsafe modes: 0 canary bits
* 32-bit: 27 canary bits

A further enhancement, not done here, would be to upgrade from canary to
parity.

```

## Parents

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

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