Skip to content

Commit

Permalink
Merge pull request #136 from afroozeh/afroozeh/fix-segfault
Browse files Browse the repository at this point in the history
Fix seg fault in scanner.c: Allocate the stack array if null
  • Loading branch information
fwcd authored Aug 2, 2024
2 parents 754394c + 2291c83 commit e1a2d5a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ unsigned tree_sitter_kotlin_external_scanner_serialize(void *payload, char *buff
void tree_sitter_kotlin_external_scanner_deserialize(void *payload, const char *buffer, unsigned length) {
Stack *stack = (Stack *)payload;
if (length > 0) {
array_reserve(stack, length);
memcpy(stack->contents, buffer, length);
stack->size = length;
} else {
Expand Down

0 comments on commit e1a2d5a

Please sign in to comment.