fix: pass a value_id the same size of predicate_capture_ids's elements to avoid big-endian integer narrowing
This solves a bug on big-endian architectures where the value would be later passed by reference as an elements "view" before being inserted. The issue is it is casted as a void pointer, and when writing uint16_t's of size 1, only 2 of the 4 bytes are written. This is okay for little-endian systems, but not big-endian
This commit is contained in:
parent
ba9f847155
commit
c16a8c71ce
1 changed files with 2 additions and 1 deletions
|
|
@ -1788,7 +1788,8 @@ static bool ts_query__analyze_patterns(TSQuery *self, unsigned *error_offset) {
|
|||
) {
|
||||
TSQueryPredicateStep *step = &self->predicate_steps.contents[j];
|
||||
if (step->type == TSQueryPredicateStepTypeCapture) {
|
||||
array_insert_sorted_by(&predicate_capture_ids, , step->value_id);
|
||||
uint16_t value_id = step->value_id;
|
||||
array_insert_sorted_by(&predicate_capture_ids, , value_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue