Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Fix section size in binary test #1424

Merged
merged 2 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion interpreter/binary/decode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ let v128 s = V128.of_bits (get_string (Types.vec_size Types.V128Type) s)
let len32 s =
let pos = pos s in
let n = vu32 s in
if I32.le_u n (Int32.of_int (len s)) then Int32.to_int n else
if I32.le_u n (Int32.of_int (len s - pos)) then Int32.to_int n else
error s pos "length out of bounds"

let bool s = (vu1 s = 1)
Expand Down
8 changes: 4 additions & 4 deletions test/core/binary.wast
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@
"\60\00\00" ;; 1st type
;; "\60\00\00" ;; 2nd type (missed)
)
"unexpected end of section or function"
"length out of bounds"
)

;; 1 type declared, 2 given
Expand Down Expand Up @@ -1600,7 +1600,7 @@
"\02\00\0b" ;; function body 0
"\02\00\0b" ;; function body 1
)
"unexpected end of section or function"
"length out of bounds"
)

;; 1 export declared, 2 given
Expand Down Expand Up @@ -1662,7 +1662,7 @@
"\03\02\01\00" ;; func section
"\04\04\01" ;; table section
"\70\00\01" ;; table 0
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
"\09\0a\02" ;; elem with inconsistent segment count (2 declared, 1 given)
"\00\41\00\0b\01\00" ;; elem 0
"\00\41\00" ;; elem 1 (partial)
;; "\0b\01\00" ;; elem 1 (missing part)
Expand Down Expand Up @@ -1774,7 +1774,7 @@
"\01\04\01" ;; type section
"\60\00\00" ;; type 0
"\03\02\01\00" ;; func section
"\0a\12\01" ;; code section
"\0a\13\01" ;; code section
"\11\00" ;; func 0
"\02\40" ;; block 0
"\41\01" ;; condition of if 0
Expand Down
2 changes: 1 addition & 1 deletion test/core/custom.wast
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"\00asm" "\01\00\00\00"
"\00\26\10" "a custom section" "this is the payload"
)
"unexpected end"
"length out of bounds"
)

(assert_malformed
Expand Down