Index: src/wasm/ast-decoder.h |
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h |
index 22ae789c1b42dfd9c57bb81f519b0a08b6cf88fc..861733b3695cdf92acca040893b1ff24c179bd93 100644 |
--- a/src/wasm/ast-decoder.h |
+++ b/src/wasm/ast-decoder.h |
@@ -185,10 +185,17 @@ struct MemoryAccessOperand { |
uint32_t alignment; |
uint32_t offset; |
unsigned length; |
- inline MemoryAccessOperand(Decoder* decoder, const byte* pc) { |
+ inline MemoryAccessOperand(Decoder* decoder, const byte* pc, |
+ uint32_t max_alignment) { |
unsigned alignment_length; |
alignment = |
decoder->checked_read_u32v(pc, 1, &alignment_length, "alignment"); |
+ if (max_alignment < alignment) { |
+ decoder->error(pc, pc + 1, |
+ "invalid alignment; expected maximum alignment is %u, " |
+ "actual alignment is %u", |
+ max_alignment, alignment); |
+ } |
unsigned offset_length; |
offset = decoder->checked_read_u32v(pc, 1 + alignment_length, |
&offset_length, "offset"); |