summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 965336857..575ceff97 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -23,6 +23,8 @@
#define wasm_wasm_s_parser_h
#include <cmath>
+#include <cctype>
+#include <limits>
#include "wasm.h"
#include "mixed_arena.h"
@@ -825,8 +827,8 @@ private:
ret->align = atoi(eq);
} else if (str[0] == 'o') {
uint64_t offset = atoll(eq);
- if (offset > 0xffffffff) onError();
- ret->offset = offset;
+ if (offset > std::numeric_limits<uint32_t>::max()) onError();
+ ret->offset = (uint32_t)offset;
} else onError();
i++;
}