Files
tree-sitter-shellspec/src/tree_sitter/alloc.c
Ismo Vuorinen dc672f8485 fix(scanner): address memory safety and correctness issues in C code
- Add len==0 check in set_contains() to prevent buffer overflow
- Add missing stdlib.h include in scanner.c
- Clear heredoc stack properly in deserialize when length==0
- Ensure NUL termination in delimiter deserialization
- Create alloc.c to define ts_current_* symbols for TREE_SITTER_REUSE_ALLOCATOR

All changes tested with full test suite: 61/61 tests passing.

Addresses PR #1 review comments from CodeRabbit.
2026-01-04 15:32:40 +02:00

10 lines
301 B
C

#include "tree_sitter/alloc.h"
#include <stdlib.h>
#ifdef TREE_SITTER_REUSE_ALLOCATOR
void *(*ts_current_malloc)(size_t) = malloc;
void *(*ts_current_calloc)(size_t,size_t) = calloc;
void *(*ts_current_realloc)(void*,size_t) = realloc;
void (*ts_current_free)(void*) = free;
#endif