Merge pull request #2177 from tree-sitter/fix-oob-2162
lib: fix OOB in query engine reported in #2162 🐛
This commit is contained in:
commit
487e3d0f56
1 changed files with 3 additions and 0 deletions
|
|
@ -938,6 +938,9 @@ static inline int analysis_state__compare(
|
|||
}
|
||||
|
||||
static inline AnalysisStateEntry *analysis_state__top(AnalysisState *self) {
|
||||
if (self->depth == 0) {
|
||||
return &self->stack[0];
|
||||
}
|
||||
return &self->stack[self->depth - 1];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue