From 029467075af31c67b7abfcd10e3e9c9a82fda40a Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Thu, 4 May 2023 16:05:58 +0200 Subject: [PATCH 1/2] [test] Remove malformed tests that become valid with memory64 With memory64, memory offsets will be decoded as u64. An engine implementing this will fail tests that test that we reject such module. Thus remove those tests from the main spec repo now; they should be added back in the memory64 repo, but changed to `assert_trap` tests. --- test/core/binary.wast | 115 ------------------------------------------ 1 file changed, 115 deletions(-) diff --git a/test/core/binary.wast b/test/core/binary.wast index 4e748e7007..596f4f9518 100644 --- a/test/core/binary.wast +++ b/test/core/binary.wast @@ -492,25 +492,6 @@ ) "integer representation too long" ) -(assert_malformed - (module binary - "\00asm" "\01\00\00\00" - "\01\04\01\60\00\00" ;; Type section - "\03\02\01\00" ;; Function section - "\05\03\01\00\01" ;; Memory section - "\0a\11\01" ;; Code section - ;; function 0 - "\0f\01\01" ;; local type count - "\7f" ;; i32 - "\41\00" ;; i32.const 0 - "\28" ;; i32.load - "\02" ;; alignment 2 - "\82\80\80\80\80\00" ;; offset 2 with one byte too many - "\1a" ;; drop - "\0b" ;; end - ) - "integer representation too long" -) (assert_malformed (module binary "\00asm" "\01\00\00\00" @@ -549,25 +530,6 @@ ) "integer representation too long" ) -(assert_malformed - (module binary - "\00asm" "\01\00\00\00" - "\01\04\01\60\00\00" ;; Type section - "\03\02\01\00" ;; Function section - "\05\03\01\00\01" ;; Memory section - "\0a\12\01" ;; Code section - ;; function 0 - "\10\01\01" ;; local type count - "\7f" ;; i32 - "\41\00" ;; i32.const 0 - "\41\03" ;; i32.const 3 - "\36" ;; i32.store - "\02" ;; alignment 2 - "\82\80\80\80\80\00" ;; offset 2 with one byte too many - "\0b" ;; end - ) - "integer representation too long" -) ;; Signed LEB128 must not be overlong (assert_malformed @@ -629,44 +591,6 @@ ) "integer too large" ) -(assert_malformed - (module binary - "\00asm" "\01\00\00\00" - "\01\04\01\60\00\00" ;; Type section - "\03\02\01\00" ;; Function section - "\05\03\01\00\01" ;; Memory section - "\0a\10\01" ;; Code section - ;; function 0 - "\0e\01\01" ;; local type count - "\7f" ;; i32 - "\41\00" ;; i32.const 0 - "\28" ;; i32.load - "\02" ;; alignment 2 - "\82\80\80\80\10" ;; offset 2 with unused bits set - "\1a" ;; drop - "\0b" ;; end - ) - "integer too large" -) -(assert_malformed - (module binary - "\00asm" "\01\00\00\00" - "\01\04\01\60\00\00" ;; Type section - "\03\02\01\00" ;; Function section - "\05\03\01\00\01" ;; Memory section - "\0a\10\01" ;; Code section - ;; function 0 - "\0e\01\01" ;; local type count - "\7f" ;; i32 - "\41\00" ;; i32.const 0 - "\28" ;; i32.load - "\02" ;; alignment 2 - "\82\80\80\80\40" ;; offset 2 with some unused bits set - "\1a" ;; drop - "\0b" ;; end - ) - "integer too large" -) (assert_malformed (module binary "\00asm" "\01\00\00\00" @@ -742,45 +666,6 @@ ) "integer too large" ) -(assert_malformed - (module binary - "\00asm" "\01\00\00\00" - "\01\04\01\60\00\00" ;; Type section - "\03\02\01\00" ;; Function section - "\05\03\01\00\01" ;; Memory section - "\0a\11\01" ;; Code section - ;; function 0 - "\0f\01\01" ;; local type count - "\7f" ;; i32 - "\41\00" ;; i32.const 0 - "\41\03" ;; i32.const 3 - "\36" ;; i32.store - "\02" ;; alignment 2 - "\82\80\80\80\10" ;; offset 2 with unused bits set - "\0b" ;; end - ) - "integer too large" -) -(assert_malformed - (module binary - "\00asm" "\01\00\00\00" - "\01\04\01\60\00\00" ;; Type section - "\03\02\01\00" ;; Function section - "\05\03\01\00\01" ;; Memory section - "\0a\11\01" ;; Code section - - ;; function 0 - "\0f\01\01" ;; local type count - "\7f" ;; i32 - "\41\00" ;; i32.const 0 - "\41\03" ;; i32.const 3 - "\36" ;; i32.store - "\02" ;; alignment 2 - "\82\80\80\80\40" ;; offset 2 with some unused bits set - "\0b" ;; end - ) - "integer too large" -) ;; Signed LEB128s sign-extend (assert_malformed From a6136e4f6df6a8f6910a1a4b12b7388de21d6dcc Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Wed, 10 May 2023 15:56:13 +0200 Subject: [PATCH 2/2] Add back tests, but commented out with a TODO --- test/core/binary.wast | 122 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/test/core/binary.wast b/test/core/binary.wast index 596f4f9518..1aae74aa38 100644 --- a/test/core/binary.wast +++ b/test/core/binary.wast @@ -492,6 +492,27 @@ ) "integer representation too long" ) +;; The memory offset will be decoded as u64 in the memory64 proposal. +;; TODO: Re-enable this test as assert_trap test in the memory64 repo. +;; (assert_malformed +;; (module binary +;; "\00asm" "\01\00\00\00" +;; "\01\04\01\60\00\00" ;; Type section +;; "\03\02\01\00" ;; Function section +;; "\05\03\01\00\01" ;; Memory section +;; "\0a\11\01" ;; Code section +;; ;; function 0 +;; "\0f\01\01" ;; local type count +;; "\7f" ;; i32 +;; "\41\00" ;; i32.const 0 +;; "\28" ;; i32.load +;; "\02" ;; alignment 2 +;; "\82\80\80\80\80\00" ;; offset 2 with one byte too many +;; "\1a" ;; drop +;; "\0b" ;; end +;; ) +;; "integer representation too long" +;; ) (assert_malformed (module binary "\00asm" "\01\00\00\00" @@ -530,6 +551,27 @@ ) "integer representation too long" ) +;; The memory offset will be decoded as u64 in the memory64 proposal. +;; TODO: Re-enable this test as assert_trap test in the memory64 repo. +;; (assert_malformed +;; (module binary +;; "\00asm" "\01\00\00\00" +;; "\01\04\01\60\00\00" ;; Type section +;; "\03\02\01\00" ;; Function section +;; "\05\03\01\00\01" ;; Memory section +;; "\0a\12\01" ;; Code section +;; ;; function 0 +;; "\10\01\01" ;; local type count +;; "\7f" ;; i32 +;; "\41\00" ;; i32.const 0 +;; "\41\03" ;; i32.const 3 +;; "\36" ;; i32.store +;; "\02" ;; alignment 2 +;; "\82\80\80\80\80\00" ;; offset 2 with one byte too many +;; "\0b" ;; end +;; ) +;; "integer representation too long" +;; ) ;; Signed LEB128 must not be overlong (assert_malformed @@ -591,6 +633,46 @@ ) "integer too large" ) +;; The memory offset will be decoded as u64 in the memory64 proposal. +;; TODO: Re-enable this test as assert_trap test in the memory64 repo. +;; (assert_malformed +;; (module binary +;; "\00asm" "\01\00\00\00" +;; "\01\04\01\60\00\00" ;; Type section +;; "\03\02\01\00" ;; Function section +;; "\05\03\01\00\01" ;; Memory section +;; "\0a\10\01" ;; Code section +;; ;; function 0 +;; "\0e\01\01" ;; local type count +;; "\7f" ;; i32 +;; "\41\00" ;; i32.const 0 +;; "\28" ;; i32.load +;; "\02" ;; alignment 2 +;; "\82\80\80\80\10" ;; offset 2 with unused bits set +;; "\1a" ;; drop +;; "\0b" ;; end +;; ) +;; "integer too large" +;; ) +;; (assert_malformed +;; (module binary +;; "\00asm" "\01\00\00\00" +;; "\01\04\01\60\00\00" ;; Type section +;; "\03\02\01\00" ;; Function section +;; "\05\03\01\00\01" ;; Memory section +;; "\0a\10\01" ;; Code section +;; ;; function 0 +;; "\0e\01\01" ;; local type count +;; "\7f" ;; i32 +;; "\41\00" ;; i32.const 0 +;; "\28" ;; i32.load +;; "\02" ;; alignment 2 +;; "\82\80\80\80\40" ;; offset 2 with some unused bits set +;; "\1a" ;; drop +;; "\0b" ;; end +;; ) +;; "integer too large" +;; ) (assert_malformed (module binary "\00asm" "\01\00\00\00" @@ -666,6 +748,46 @@ ) "integer too large" ) +;; The memory offset will be decoded as u64 in the memory64 proposal. +;; TODO: Re-enable this test as assert_trap test in the memory64 repo. +;; (assert_malformed +;; (module binary +;; "\00asm" "\01\00\00\00" +;; "\01\04\01\60\00\00" ;; Type section +;; "\03\02\01\00" ;; Function section +;; "\05\03\01\00\01" ;; Memory section +;; "\0a\11\01" ;; Code section +;; ;; function 0 +;; "\0f\01\01" ;; local type count +;; "\7f" ;; i32 +;; "\41\00" ;; i32.const 0 +;; "\41\03" ;; i32.const 3 +;; "\36" ;; i32.store +;; "\02" ;; alignment 2 +;; "\82\80\80\80\10" ;; offset 2 with unused bits set +;; "\0b" ;; end +;; ) +;; "integer too large" +;; ) +;; (assert_malformed +;; (module binary +;; "\00asm" "\01\00\00\00" +;; "\01\04\01\60\00\00" ;; Type section +;; "\03\02\01\00" ;; Function section +;; "\05\03\01\00\01" ;; Memory section +;; "\0a\11\01" ;; Code section +;; ;; function 0 +;; "\0f\01\01" ;; local type count +;; "\7f" ;; i32 +;; "\41\00" ;; i32.const 0 +;; "\41\03" ;; i32.const 3 +;; "\36" ;; i32.store +;; "\02" ;; alignment 2 +;; "\82\80\80\80\40" ;; offset 2 with some unused bits set +;; "\0b" ;; end +;; ) +;; "integer too large" +;; ) ;; Signed LEB128s sign-extend (assert_malformed