Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using lyd_parse_data_mem #1841

Closed
AeroFlorian opened this issue May 5, 2022 · 3 comments
Closed

Crash when using lyd_parse_data_mem #1841

AeroFlorian opened this issue May 5, 2022 · 3 comments
Labels
is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)

Comments

@AeroFlorian
Copy link

Version used : devel 2.0.188
Previous working version: devel 2.0.116

Here is the stack:
#4 0x00007f3c68b90476 in get_node_pos (node=0x7f3c54066ed0, node_type=LYXP_NODE_ELEM,
root=0x7f3c5404a1a0, root_type=LYXP_NODE_ROOT_CONFIG, prev=0x7f3c5f7fc5e8,
prev_pos=0x7f3c5f7fc5e0) at /opt/dev/libyang/src/xpath.c:1363
#5 0x00007f3c68b9075b in set_assign_pos (set=0x7f3c5f7fce80, root=0x7f3c5404a1a0,
root_type=LYXP_NODE_ROOT_CONFIG) at /opt/dev/libyang/src/xpath.c:1434
#6 0x00007f3c68b90f53 in set_sort (set=0x7f3c5f7fce80) at /opt/dev/libyang/src/xpath.c:1658
#7 0x00007f3c68b9c757 in moveto_node (set=0x7f3c5f7fce80, moveto_mod=0x557018b161f0,
ncname=0x557018b23340 "tx-array-carriers", options=2) at /opt/dev/libyang/src/xpath.c:5589
#8 0x00007f3c68ba0efc in eval_name_test_with_predicate (exp=0x557018b566a0,
tok_idx=0x7f3c5f7fcdda, attr_axis=0 '\000', all_desc=0 '\000', set=0x7f3c5f7fce80,
options=2) at /opt/dev/libyang/src/xpath.c:7344
#9 0x00007f3c68ba1842 in eval_relative_location_path (exp=0x557018b566a0,
tok_idx=0x7f3c5f7fcdda, all_desc=0 '\000', set=0x7f3c5f7fce80, options=2)
at /opt/dev/libyang/src/xpath.c:7516
#10 0x00007f3c68ba1acf in eval_absolute_location_path (exp=0x557018b566a0,
tok_idx=0x7f3c5f7fcdda, set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:7585
#11 0x00007f3c68ba366e in eval_path_expr (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda,
set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:8005
--Type for more, q to quit, c to continue without paging--
#12 0x00007f3c68ba5a8e in eval_expr_select (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda,
etype=LYXP_EXPR_EQUALITY, set=0x7f3c5f7fce80, options=2)
at /opt/dev/libyang/src/xpath.c:8660
#13 0x00007f3c68ba4c68 in eval_equality_expr (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda,
repeat=1, set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:8415
#14 0x00007f3c68ba59b7 in eval_expr_select (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda,
etype=LYXP_EXPR_NONE, set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:8642
#15 0x00007f3c68ba34aa in eval_path_expr (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda,
set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:7963
#16 0x00007f3c68ba5a8e in eval_expr_select (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda,
etype=LYXP_EXPR_AND, set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:8660
#17 0x00007f3c68ba5127 in eval_and_expr (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda, repeat=1,
set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:8482
#18 0x00007f3c68ba5991 in eval_expr_select (exp=0x557018b566a0, tok_idx=0x7f3c5f7fcdda,
etype=LYXP_EXPR_NONE, set=0x7f3c5f7fce80, options=2) at /opt/dev/libyang/src/xpath.c:8639
#19 0x00007f3c68ba5f74 in lyxp_eval (ctx=0x5570189de010, exp=0x557018b566a0,
cur_mod=0x557018b161f0, format=LY_VALUE_SCHEMA_RESOLVED, prefix_data=0x557018b569b8,
ctx_node=0x7f3c54080ac0, tree=0x7f3c5404a1a0, vars=0x0, set=0x7f3c5f7fce80, options=2)
at /opt/dev/libyang/src/xpath.c:8761
#20 0x00007f3c68ba7264 in lyd_validate_node_when (tree=0x7f3c5404a1a0, node=0x7f3c54080ac0,
schema=0x557018b565e0, xpath_options=0, disabled=0x7f3c5f7fcfa0)
at /opt/dev/libyang/src/validation.c:154
--Type for more, q to quit, c to continue without paging--
#21 0x00007f3c68ba877e in lyd_validate_dummy_when (first=0x7f3c54065090,
parent=0x7f3c54065040, snode=0x557018b565e0, disabled=0x7f3c5f7fcfa0)
at /opt/dev/libyang/src/validation.c:741
#22 0x00007f3c68ba88e7 in lyd_validate_mandatory (first=0x7f3c54065090, parent=0x7f3c54065040,
snode=0x557018b565e0) at /opt/dev/libyang/src/validation.c:787
#23 0x00007f3c68ba9a11 in lyd_validate_siblings_schema_r (first=0x7f3c54065090,
parent=0x7f3c54065040, sparent=0x557018b557e0, mod=0x0, val_opts=0, int_opts=0)
at /opt/dev/libyang/src/validation.c:1184
#24 0x00007f3c68baa4a5 in lyd_validate_final_r (first=0x7f3c54065090, parent=0x7f3c54065040,
sparent=0x557018b557e0, mod=0x0, val_opts=0, int_opts=0, must_xp_opts=0)
at /opt/dev/libyang/src/validation.c:1391
#25 0x00007f3c68baa52c in lyd_validate_final_r (first=0x7f3c54063a70, parent=0x7f3c5404def0,
sparent=0x557018b4e590, mod=0x0, val_opts=0, int_opts=0, must_xp_opts=0)
at /opt/dev/libyang/src/validation.c:1400
#26 0x00007f3c68baa52c in lyd_validate_final_r (first=0x7f3c5404def0, parent=0x0, sparent=0x0,
mod=0x557018b161f0, val_opts=0, int_opts=0, must_xp_opts=0)
at /opt/dev/libyang/src/validation.c:1400
#27 0x00007f3c68bab011 in lyd_validate (tree=0x7f3c5f7fd550, module=0x0, ctx=0x5570189de010,
val_opts=0, validate_subtree=0 '\000', node_when_p=0x7f3c54054348,
node_types_p=0x7f3c54054358, meta_types_p=0x7f3c54054368, ext_val_p=0x7f3c54054378,
diff=0x0) at /opt/dev/libyang/src/validation.c:1605
#28 0x00007f3c68ac4ba4 in lyd_parse (ctx=0x5570189de010, ext=0x0, parent=0x0,
--Type for more, q to quit, c to continue without paging--
first_p=0x7f3c5f7fd550, in=0x7f3c5400dd60, format=LYD_XML, parse_opts=131072, val_opts=0,
op=0x0) at /opt/dev/libyang/src/tree_data.c:391
#29 0x00007f3c68ac4fed in lyd_parse_data (ctx=0x5570189de010, parent=0x0, in=0x7f3c5400dd60,
format=LYD_XML, parse_options=131072, validate_options=0, tree=0x7f3c5f7fd550)
at /opt/dev/libyang/src/tree_data.c:444
#30 0x00007f3c68ac5070 in lyd_parse_data_mem (ctx=0x5570189de010,
data=0x7f3c644d8037 "<yang-library xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">\n 61\n \n complete\n \n\n<modules-state xmlns="urn:ietf:param"..., format=LYD_XML, parse_options=131072,
validate_options=0, tree=0x7f3c5f7fd550) at /opt/dev/libyang/src/tree_data.c:455

I can share the xml used via mail ([email protected])

@michalvasko
Copy link
Member

I think I will need to reproduce it to fix, please send the YANG/data to the email in my profile.

@michalvasko michalvasko added the is:bug Bug description. label May 5, 2022
@michalvasko
Copy link
Member

Thanks for the nice example, was actually quite a minor bug. And it was not exposed before only because it was hidden by another bug that I have fixed recently.

@michalvasko michalvasko added the status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...) label May 6, 2022
@AeroFlorian
Copy link
Author

Perfect, will reproduce with the example before closing.
Thanks for the amazing support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)
Projects
None yet
Development

No branches or pull requests

2 participants