# wasm: Add a check for zero length around uses of memory.copy/memory.fill\. · gitcafe/zig

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

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

Visibility: public

Requested revision: e800ea0fdd4ecbe2e28867550a8c36715f3c5ea9

Requested commit: e800ea0fdd4ecbe2e28867550a8c36715f3c5ea9

Commit: e800ea0fdd4ecbe2e28867550a8c36715f3c5ea9

Tree: cc70cb1dc7b483e7fb49510c520452fb49bda8ee

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
wasm: Add a check for zero length around uses of memory.copy/memory.fill.

Apparently the WebAssembly spec requires these instructions to trap if the
computed memory access could be out of bounds, even if the length is zero.
Really a rather bizarre design choice.

```

## Parents

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

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