Fix a few cases of Clang 10 with UBSAN detecting undefined behavior
Clang 10 considers adding any offset, including 0, to the null pointer to be undefined behavior. `(void *)NULL + 0 = kaboom`.
This commit is contained in:
parent
d5576e306c
commit
00c470ab2a
2 changed files with 4 additions and 1 deletions
|
|
@ -1252,6 +1252,9 @@ const TSQueryPredicateStep *ts_query_predicates_for_pattern(
|
|||
) {
|
||||
Slice slice = self->predicates_by_pattern.contents[pattern_index];
|
||||
*step_count = slice.length;
|
||||
if (self->predicate_steps.contents == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return &self->predicate_steps.contents[slice.offset];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue