Skip to content

Commit 8b76291

Browse files
committed
fix: out of bounds panic with too short predicates
1 parent 98cb033 commit 8b76291

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Cargo.toml

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ members = [
1717
"./syntastica-js",
1818
]
1919

20-
package.version = "0.4.0"
20+
package.version = "0.4.1"
2121
package.authors = ["RubixDev <[email protected]>"]
2222
package.documentation = "https://rubixdev.github.io/syntastica/"
2323
package.edition = "2021"
@@ -31,17 +31,17 @@ sign-tag = true
3131
shared-version = true
3232

3333
[workspace.dependencies]
34-
syntastica = { version = "0.4.0", path = "./" }
35-
syntastica-core = { version = "0.4.0", path = "./syntastica-core", default-features = false }
36-
syntastica-highlight = { version = "0.4.0", path = "./syntastica-highlight", default-features = false }
37-
syntastica-macros = { version = "0.4.0", path = "./syntastica-macros" }
38-
syntastica-parsers = { version = "0.4.0", path = "./syntastica-parsers" }
39-
syntastica-parsers-dynamic = { version = "0.4.0", path = "./syntastica-parsers-dynamic" }
40-
syntastica-parsers-git = { version = "0.4.0", path = "./syntastica-parsers-git" }
41-
syntastica-parsers-gitdep = { version = "0.4.0", path = "./syntastica-parsers-gitdep" }
42-
syntastica-query-preprocessor = { version = "0.4.0", path = "./syntastica-query-preprocessor" }
43-
syntastica-queries = { version = "0.4.0", path = "./syntastica-queries" }
44-
syntastica-themes = { version = "0.4.0", path = "./syntastica-themes" }
34+
syntastica = { version = "0.4.1", path = "./" }
35+
syntastica-core = { version = "0.4.1", path = "./syntastica-core", default-features = false }
36+
syntastica-highlight = { version = "0.4.1", path = "./syntastica-highlight", default-features = false }
37+
syntastica-macros = { version = "0.4.1", path = "./syntastica-macros" }
38+
syntastica-parsers = { version = "0.4.1", path = "./syntastica-parsers" }
39+
syntastica-parsers-dynamic = { version = "0.4.1", path = "./syntastica-parsers-dynamic" }
40+
syntastica-parsers-git = { version = "0.4.1", path = "./syntastica-parsers-git" }
41+
syntastica-parsers-gitdep = { version = "0.4.1", path = "./syntastica-parsers-gitdep" }
42+
syntastica-query-preprocessor = { version = "0.4.1", path = "./syntastica-query-preprocessor" }
43+
syntastica-queries = { version = "0.4.1", path = "./syntastica-queries" }
44+
syntastica-themes = { version = "0.4.1", path = "./syntastica-themes" }
4545

4646
tree-sitter = "0.20.10"
4747
tree-sitter-c2rust = "0.20.10"

syntastica-query-preprocessor/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ fn replace_predicates(tree: &mut OwnedSexpr) {
388388
if let OwnedSexpr::List(list) | OwnedSexpr::Group(list) = tree {
389389
match list.first() {
390390
Some(OwnedSexpr::Atom(atom)) if atom.first() == Some(&b'#') => {
391-
let match_predicate = OwnedSexpr::Atom(match &atom[..5] == b"#not-" {
391+
let match_predicate = OwnedSexpr::Atom(match atom.starts_with(b"#not-") {
392392
false => b"#match?".to_vec(),
393393
true => b"#not-match?".to_vec(),
394394
});

0 commit comments

Comments
 (0)