From e9a8c80af5e99430d67cebcf7ac459e5fd243a1e Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 11 Jan 2023 15:36:59 +0900 Subject: [PATCH] fix int32 overflow when grabbing strings from wasm --- trealla/string.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trealla/string.go b/trealla/string.go index 93a49d8..f679421 100644 --- a/trealla/string.go +++ b/trealla/string.go @@ -44,8 +44,8 @@ func (str *cstring) free(pl *prolog) error { func (pl *prolog) gets(addr, size int32) (string, error) { data := pl.memory.Data() - ptr := int(addr) - end := int(addr + size) + ptr := int(uint32(addr)) + end := int(uint32(addr + size)) if end >= len(data) { return "", fmt.Errorf("invalid string of %d length at: %d", size, addr) }