Update tree-sitter to 0.24 (#24492)

I didn't update it to 0.25 because its Wasm support seems to be
partially broken due to
https://github.com/tree-sitter/tree-sitter/pull/3938: it didn't
introduce a check that the Wasm module's ABI is new enough to include
supertype info while parsing it, and so in the case where it isn't it
ends up interpreting random bytes as the number of supertypes, causing
out-of-bounds memory accesses.

Closes #24489

Release Notes:

- Fixed a rare crash during syntax highlighting
This commit is contained in:
Liam Murphy
2025-02-10 10:52:27 -08:00
committed by GitHub
parent d9909c691d
commit 72e1947025
16 changed files with 141 additions and 127 deletions
+3 -2
View File
@@ -17,6 +17,7 @@ use std::{
str::{self, FromStr},
sync::{Arc, LazyLock},
};
use streaming_iterator::StreamingIterator;
use tree_sitter::Query;
use util::RangeExt;
@@ -1262,8 +1263,8 @@ fn replace_value_in_json_text(
let mut last_value_range = 0..0;
let mut first_key_start = None;
let mut existing_value_range = 0..text.len();
let matches = cursor.matches(&PAIR_QUERY, syntax_tree.root_node(), text.as_bytes());
for mat in matches {
let mut matches = cursor.matches(&PAIR_QUERY, syntax_tree.root_node(), text.as_bytes());
while let Some(mat) = matches.next() {
if mat.captures.len() != 2 {
continue;
}