fix(wasm): fix alias map size computation
This fixes a crash where parsing with certain languages can lead to a crash due to how the alias map was allocated and laid out in wasm memory
This commit is contained in:
parent
f222db57ce
commit
f09dc3cf46
7 changed files with 80 additions and 26 deletions
|
|
@ -1377,11 +1377,12 @@ const TSLanguage *ts_wasm_store_load_language(
|
|||
if (symbol == 0) break;
|
||||
uint16_t value_count;
|
||||
memcpy(&value_count, &memory[wasm_language.alias_map + alias_map_size], sizeof(value_count));
|
||||
alias_map_size += sizeof(uint16_t);
|
||||
alias_map_size += value_count * sizeof(TSSymbol);
|
||||
}
|
||||
language->alias_map = copy(
|
||||
&memory[wasm_language.alias_map],
|
||||
alias_map_size * sizeof(TSSymbol)
|
||||
alias_map_size
|
||||
);
|
||||
language->alias_sequences = copy(
|
||||
&memory[wasm_language.alias_sequences],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue