validate table type for call_indirect
This commit is contained in:
@@ -278,6 +278,8 @@ getInstrType _ (CallIndirect tableIdx sign) = do
|
|||||||
if length tables <= fromIntegral tableIdx
|
if length tables <= fromIntegral tableIdx
|
||||||
then throwError (TableIndexOutOfRange tableIdx)
|
then throwError (TableIndexOutOfRange tableIdx)
|
||||||
else do
|
else do
|
||||||
|
let TableType _ elemType = tables !! fromIntegral tableIdx
|
||||||
|
when (elemType /= FuncRef) $ throwError (RefTypeMismatch FuncRef ExternRef)
|
||||||
Arrow from to <- maybeToEither TypeIndexOutOfRange $ asArrow <$> types !? sign
|
Arrow from to <- maybeToEither TypeIndexOutOfRange $ asArrow <$> types !? sign
|
||||||
return $ (from ++ [Val I32]) ==> to
|
return $ (from ++ [Val I32]) ==> to
|
||||||
getInstrType _ Drop = do
|
getInstrType _ Drop = do
|
||||||
|
|||||||
Reference in New Issue
Block a user