diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-09-09 20:44:41 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-09-09 20:44:41 -0400 |
| commit | a3c6cd9a0f8acb08916d8a8a80771628d246debf (patch) | |
| tree | 307f2e711c42e4652d9320fea016a2291f1e3c5e | |
| parent | d64dcab138a34d5f5105e08f0a840f7cb5a1d159 (diff) | |
Fix for potential null dereference
| -rw-r--r-- | src/formatter/formatter.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c index 2c52aa63..07a70afa 100644 --- a/src/formatter/formatter.c +++ b/src/formatter/formatter.c @@ -54,7 +54,9 @@ PUREFUNC text_opts_t choose_text_options(ast_list_t *chunks) { } static bool starts_with_id(Text_t text) { + if (text.length <= 0) return false; List_t codepoints = Text$utf32(Text$slice(text, I_small(1), I_small(1))); + if (codepoints.length <= 0 || codepoints.data == NULL) return false; return uc_is_property_xid_continue(*(ucs4_t *)codepoints.data); } |
