# macho\+elf: fix integer overflow in allocateAtom · gitcafe/zig

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

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

Visibility: public

Requested revision: 406c85f9ba056e10899feed18dae91e20942dc55

Requested commit: 406c85f9ba056e10899feed18dae91e20942dc55

Commit: 406c85f9ba056e10899feed18dae91e20942dc55

Tree: fbc6b204723691dfad10851137c7df67858d679b

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
macho+elf: fix integer overflow in allocateAtom

If there is a big atom available for re-use in the free list, and
it's the last atom in section, it's ideal capacity might span the
entire section in which case we do not want to calculate the actual
end VM addr of the symbol since it may overflow. Instead, we just take
the max capacity available as end VM addr estimate. In this case,
the max capacity equals `std.math.maxInt(u64)`.

```

## Parents

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

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