mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:26:23 -04:00
The wasm store gated supertype_symbols / supertype_map_slices /
supertype_map_entries copies on abi_version > LANGUAGE_VERSION_WITH_RESERVED_WORDS,
but every other consumer (language.c, query.c) treats those tables as
present when abi_version >= LANGUAGE_VERSION_WITH_RESERVED_WORDS.
A Wasm grammar built at ABI exactly 15 with supertype_count > 0 ends up
with supertype_count copied into the native TSLanguage but supertype_map_slices
left NULL. ts_query__analyze_patterns then calls ts_language_subtypes,
which dereferences self->supertype_map_slices[supertype] and crashes.
(cherry picked from commit a53c3b03a0)
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
2cad8b8d47
commit
7aea01521d
|
|
@ -1215,7 +1215,7 @@ const TSLanguage *ts_wasm_store_load_language(
|
|||
memcpy(&wasm_language, &memory[language_address], sizeof(LanguageInWasmMemory));
|
||||
|
||||
bool has_supertypes =
|
||||
wasm_language.abi_version > LANGUAGE_VERSION_WITH_RESERVED_WORDS &&
|
||||
wasm_language.abi_version >= LANGUAGE_VERSION_WITH_RESERVED_WORDS &&
|
||||
wasm_language.supertype_count > 0;
|
||||
|
||||
int32_t addresses[] = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue