diff options
author | Ben Smith <binjimin@gmail.com> | 2016-12-20 11:25:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-20 11:25:06 -0800 |
commit | 1d9e26d68c95c26066ebb75328ca0dd95d4d536b (patch) | |
tree | fc222ae415e0123c54e0afea84da00506b38b093 /src/validator.c | |
parent | 050712d06ece5ef934f820a32dad2c75a6320815 (diff) | |
download | wabt-1d9e26d68c95c26066ebb75328ca0dd95d4d536b.tar.gz wabt-1d9e26d68c95c26066ebb75328ca0dd95d4d536b.tar.bz2 wabt-1d9e26d68c95c26066ebb75328ca0dd95d4d536b.zip |
Validate function vars in elem segments (#250)
They must reference a valid function.
Diffstat (limited to 'src/validator.c')
-rw-r--r-- | src/validator.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/validator.c b/src/validator.c index 79b3316d..fd558f97 100644 --- a/src/validator.c +++ b/src/validator.c @@ -929,6 +929,13 @@ static void check_elem_segments(Context* ctx, const WasmModule* module) { check_table_var(ctx, &elem_segment->table_var, &table))) continue; + size_t i; + for (i = 0; i < elem_segment->vars.size; ++i) { + if (!WASM_SUCCEEDED( + check_func_var(ctx, &elem_segment->vars.data[i], NULL))) + continue; + } + check_const_init_expr(ctx, &field->loc, elem_segment->offset, WASM_TYPE_I32, "elem segment offset"); } |