File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,10 @@ struct ExpressionParser<Visitor: InstructionVisitor> {
398398 try parser. consume ( )
399399 var subParser = Parser ( String ( maybeAlign. dropFirst ( alignPrefix. count) ) )
400400 align = try subParser. expectUnsignedInt ( UInt32 . self)
401+
402+ if align == 0 || align & ( align - 1 ) != 0 {
403+ throw WatParserError ( " alignment must be a power of 2 " , location: subParser. lexer. location ( ) )
404+ }
401405 }
402406 return MemArg ( offset: offset, align: align)
403407 }
Original file line number Diff line number Diff line change @@ -107,8 +107,6 @@ class EncoderTests: XCTestCase {
107107
108108 var stats = CompatibilityTestStats ( )
109109 let excluded : [ String ] = [
110- " align.wast " ,
111- " align64.wast " ,
112110 " block.wast " ,
113111 " call_indirect.wast " ,
114112 " const.wast " ,
You can’t perform that action at this time.
0 commit comments