bytecodealliance / bytecodealliance/wasmtime-go

Compilation failure on 32-bit systems

Open
#199 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
913
Forks
100
Avg merge
10m
Merged PRs (30d)
1

Description

In memory.go:
```
func (mem *Memory) UnsafeData(store Storelike) []byte {
// see https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices
const MaxLen = 1 << 32
length := mem.DataSize(store)
if length >= MaxLen {
panic("memory is too big")
}
return (*[MaxLen]byte)(mem.Data(store))[:length:length]
}
```
The 1 << 32 results in an overflow because uintptr type is 32bit on 32bit systems.
I suggest replacing it with 0xffffffff instead. That should remove the compilation error.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.