-
Notifications
You must be signed in to change notification settings - Fork 319
Description
Hi,
I know that libyang1 is deprecated, but as i found this bug and have a fix for it, it is better to share it.
In file https://github.com/CESNET/libyang/blob/libyang1/src/resolve.c#L8631 , i fell in a case where the when statement was previously resolved to false (prev_when_status = LYD_WHEN | LYD_WHEN_FALSE).
Calling resolve_unres_data_item() would call resolve_when() which will now resolve to true (node->when_status |= LYD_WHEN_TRUE), but due to the when_status flag not being reset, we end up with a wrong value:
node->when_status = LYD_WHEN | LYD_WHEN_FALSE | LYD_WHEN_TRUE .
This makes the code crash in file https://github.com/CESNET/libyang/blob/libyang1/src/resolve.c#L8638 because the condition unres->node[i]->when_status & LYD_WHEN_FALSE is still true, but the when pointer is NULL due to the successful resolve.
resetting the flag in resolve_when() by adding node->when_status &= LYD_WHEN; at the beginning of the function would fix the bug.