Skip to content

Commit

Permalink
printer json BUGFIX nested union value print
Browse files Browse the repository at this point in the history
Fix an infinite loop in json_print_value() when
resolved type of a union member is also union.

Fixes: 183b911 ("printer json BUGFIX union realtype value print")

Signed-off-by: Ilyes Ben Hamouda <[email protected]>
  • Loading branch information
Ilyes Ben Hamouda committed Sep 7, 2023
1 parent 8b0b910 commit 0f5f8c9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/printer_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ json_print_value(struct jsonpr_ctx *pctx, const struct ly_ctx *ctx, const struct
switch (basetype) {
case LY_TYPE_UNION:
/* use the resolved type */
basetype = val->subvalue->value.realtype->basetype;
val = &val->subvalue->value;
basetype = val->realtype->basetype;
goto print_val;

case LY_TYPE_BINARY:
Expand Down

0 comments on commit 0f5f8c9

Please sign in to comment.