fuzzy: Use lowercase representations for matrix size calculation (#44338)

Closes #44324

Release Notes:

- Uses the lowercase representation of the query for the matrix length
calculation to match the bounds size expected in `recursive_score_match`
This commit is contained in:
Nereuxofficial
2025-12-08 19:50:20 +01:00
committed by GitHub
parent b948d8b9e7
commit 4a382b2797

View File

@@ -96,7 +96,8 @@ impl<'a> Matcher<'a> {
continue;
}
let matrix_len = self.query.len() * (prefix.len() + candidate_chars.len());
let matrix_len =
self.query.len() * (lowercase_prefix.len() + lowercase_candidate_chars.len());
self.score_matrix.clear();
self.score_matrix.resize(matrix_len, None);
self.best_position_matrix.clear();
@@ -596,4 +597,15 @@ mod tests {
})
.collect()
}
/// Test for https://github.com/zed-industries/zed/issues/44324
#[test]
fn test_recursive_score_match_index_out_of_bounds() {
let paths = vec!["İ/İ/İ/İ"];
let query = "İ/İ";
// This panicked with "index out of bounds: the len is 21 but the index is 22"
let result = match_single_path_query(query, false, &paths);
let _ = result;
}
}