From b27ce14618a383f5f1696dda83fd62a9cbdbbe4b Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Mon, 16 Apr 2018 20:11:46 -0700 Subject: [PATCH] check if length of code section equals of length of function type section --- src/Language/Wasm/Binary.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Language/Wasm/Binary.hs b/src/Language/Wasm/Binary.hs index 8edaa0e..949c920 100644 --- a/src/Language/Wasm/Binary.hs +++ b/src/Language/Wasm/Binary.hs @@ -790,6 +790,9 @@ instance Serialize Module where elems <- getSection ElementSection getVec [] functions <- getSection CodeSection getVec [] datas <- getSection DataSection getVec [] + if length funcTypes /= length functions + then fail "function and code section have inconsistent lengths" + else return () return $ emptyModule { types, imports,