# std.math.big.int: breaking API changes to prevent UAF · gitcafe/zig

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

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

Visibility: public

Requested revision: 54454fd0102af8b25dbc85751d37fd265380d920

Requested commit: 54454fd0102af8b25dbc85751d37fd265380d920

Commit: 54454fd0102af8b25dbc85751d37fd265380d920

Tree: cdab71c06e0a8269fa3349c5b4b62be91d8cac4e

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.math.big.int: breaking API changes to prevent UAF

Many of the Managed methods accepted by-val parameters which could
reference Limb slices that became invalid memory after any
ensureCapacity calls. Now, Managed methods accept `*const Managed`
parameters so that if the function allows aliasing and the
ensure-capacity call resizes the Limb slice, it also affects the
aliased parameters, avoiding use-after-free bugs.

This is a breaking change that reduces the requirement for callsites to
manually make the ensure-capacity changes prior to calling many of the
Managed methods.

Closes #11897

```

## Parents

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

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