mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-03 01:47:09 +00:00
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.
This commit is contained in:
9
src/tree_sitter/alloc.c
Normal file
9
src/tree_sitter/alloc.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user