Avoid use-after-free of external token states
Previously, it was possible for references to external token states to outlive the trees to which those states belonged. Now, instead of storing references to external token states in the Stack and in the Lexer, we store references to the external token trees themselves, and we retain the trees to prevent use-after-free.
This commit is contained in:
parent
f678018d3d
commit
0143bfdad4
11 changed files with 147 additions and 118 deletions
|
|
@ -67,9 +67,9 @@ unsigned ts_stack_push_count(const Stack *, StackVersion);
|
|||
|
||||
void ts_stack_decrease_push_count(Stack *, StackVersion, unsigned);
|
||||
|
||||
const TSExternalTokenState *ts_stack_external_token_state(const Stack *, StackVersion);
|
||||
Tree *ts_stack_last_external_token(const Stack *, StackVersion);
|
||||
|
||||
void ts_stack_set_external_token_state(Stack *, StackVersion, const TSExternalTokenState *);
|
||||
void ts_stack_set_last_external_token(Stack *, StackVersion, Tree *);
|
||||
|
||||
/*
|
||||
* Get the position at the top of the given version of the stack. If the stack
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue