aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-05-18 14:28:46 +0900
committernsfisis <nsfisis@gmail.com>2024-05-18 14:28:46 +0900
commit829f6e531525fa82c5fa948e6bb96bb6469685a2 (patch)
tree2e1456e441910eb363c74dc0c81555070f883fbb /src
parentb5455751929d7f9a3581e27eb0adcf7ef9d01a0c (diff)
downloadphp-waddiwasi-829f6e531525fa82c5fa948e6bb96bb6469685a2.tar.gz
php-waddiwasi-829f6e531525fa82c5fa948e6bb96bb6469685a2.tar.zst
php-waddiwasi-829f6e531525fa82c5fa948e6bb96bb6469685a2.zip
fix: memory address should be treated as unsigned integer
Diffstat (limited to 'src')
-rw-r--r--src/Execution/Runtime.php42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php
index 90d05e6..bf010c9 100644
--- a/src/Execution/Runtime.php
+++ b/src/Execution/Runtime.php
@@ -1955,7 +1955,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI32_s32($ea);
if ($c === null) {
@@ -1970,7 +1970,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI32_s16($ea);
if ($c === null) {
@@ -1985,7 +1985,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI32_u16($ea);
if ($c === null) {
@@ -2000,7 +2000,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI32_s8($ea);
if ($c === null) {
@@ -2015,7 +2015,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI32_u8($ea);
if ($c === null) {
@@ -2031,7 +2031,7 @@ final class Runtime
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
$c = $this->stack->popInt();
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$ok = $mem->storeI32_s32($ea, $c);
if (!$ok) {
@@ -2046,7 +2046,7 @@ final class Runtime
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
$c = $this->stack->popInt();
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$ok = $mem->storeI32_s16($ea, $c);
if (!$ok) {
@@ -2061,7 +2061,7 @@ final class Runtime
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
$c = $this->stack->popInt();
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$ok = $mem->storeI32_s8($ea, $c);
if (!$ok) {
@@ -2075,7 +2075,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI64_s64($ea);
if ($c === null) {
@@ -2090,7 +2090,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI64_s16($ea);
if ($c === null) {
@@ -2105,7 +2105,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI64_u16($ea);
if ($c === null) {
@@ -2120,7 +2120,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI64_s32($ea);
if ($c === null) {
@@ -2135,7 +2135,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI64_u32($ea);
if ($c === null) {
@@ -2150,7 +2150,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI64_s8($ea);
if ($c === null) {
@@ -2165,7 +2165,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadI64_u8($ea);
if ($c === null) {
@@ -2181,7 +2181,7 @@ final class Runtime
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
$c = $this->stack->popInt();
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$ok = $mem->storeI64_s64($ea, $c);
if (!$ok) {
@@ -2196,7 +2196,7 @@ final class Runtime
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
$c = $this->stack->popInt();
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$ok = $mem->storeI64_s16($ea, $c);
if (!$ok) {
@@ -2211,7 +2211,7 @@ final class Runtime
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
$c = $this->stack->popInt();
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$ok = $mem->storeI64_s32($ea, $c);
if (!$ok) {
@@ -2226,7 +2226,7 @@ final class Runtime
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
$c = $this->stack->popInt();
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$ok = $mem->storeI64_s8($ea, $c);
if (!$ok) {
@@ -2457,7 +2457,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadF32($ea);
if ($c === null) {
@@ -2471,7 +2471,7 @@ final class Runtime
$f = $this->stack->currentFrame();
$a = $f->module->memAddrs[0];
$mem = $this->store->mems[$a];
- $i = $this->stack->popInt();
+ $i = self::wasmI32ToPhpInt($this->stack->popInt());
$ea = $i + $offset;
$c = $mem->loadF64($ea);
if ($c === null) {