Skip to content

SIGABRT when parsing yangdata #2070

@zhuxiaoyun138159

Description

@zhuxiaoyun138159

YANG:

module ietf-netconf {
  // the namespace for NETCONF XML definitions is unchanged
  // from RFC 4741, which this document replaces
  namespace "urn:ietf:params:xml:ns:netconf:base:1.0";

  prefix nc;

  rc:yang-data yang-errors {
    uses rpc-error;
  }

  grouping rpc-error {
    description
      "A grouping that contains a YANG container
       representing the syntax and semantics of a
       YANG Patch error report within a response message.";

    container rpc-error {
      description
        "An entry containing information about one
          specific error that occurred while processing
          a RESTCONF request.";
      reference
        "RFC 6241, Section 4.3.";

      leaf error-type {
        type enumeration {
          enum transport {
            description
              "The transport layer.";
          }
          enum rpc {
            description
              "The rpc or notification layer.";
          }
          enum protocol {
            description
              "The protocol operation layer.";
          }
          enum application {
            description
              "The server application layer.";
          }
        }
        mandatory true;
        description
          "The protocol layer where the error occurred.";
      }

      leaf error-tag {
        type string;
        mandatory true;
        description
          "The enumerated error-tag.";
      }

      leaf error-severity {
        type string;
        description
          "Contains a string identifying the error severity, as determined by the device.";
      }

      leaf error-app-tag {
        type string;
        description
          "The application-specific error-tag.";
      }

      leaf error-path {
        type string;
        description
          "The YANG instance identifier associated
            with the error node.";
      }

      leaf error-message {
        type string;
        description
          "A message describing the error.";
      }
    }
  }

}

when I use lyd_parse_ext_data parse :

{"ietf-netconf:rpc-error":{"error-type":"application","error-tag":"operation-failed","error-app-tag":"4294967295","error-message":"Error: error test 1","error-path":"/"},"ietf-netconf:rpc-error":{"error-type":"application","error-tag":"operation-failed","error-app-tag":"4294967295","error-message":"Error: error test 2","error-path":"/"}}
Thread 26 "test" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=281472854651168, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44      pthread_kill.c: No such file or directory.
(gdb) bt
#0  __pthread_kill_implementation (threadid=281472854651168, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x0000ffff8d441a14 in __pthread_kill_internal (signo=<optimized out>, threadid=<optimized out>) at pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at pthread_kill.c:89
#3  0x0000ffff8d3fa6ac in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x0000ffff8d3fb9a8 in __GI_abort () at abort.c:79
#5  0x0000ffff8d3f3f4c in __assert_fail_base (fmt=0xffff8d516280 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0xffff81a15ff8 "schema", file=file@entry=0xffff81a15e50 "/usr1/libyang/src/tree_data.c", 
    line=line@entry=510, function=function@entry=0xffff81a16a90 <__PRETTY_FUNCTION__.12142> "lyd_insert_get_next_anchor") at assert.c:92
#6  0x0000ffff8d3f3fcc in __GI___assert_fail (assertion=0xffff81a15ff8 "schema", file=0xffff81a15e50 "/usr1/libyang/src/tree_data.c", line=510, function=0xffff81a16a90 <__PRETTY_FUNCTION__.12142> "lyd_insert_get_next_anchor") at assert.c:101
#7  0x0000ffff818f91c0 in lyd_insert_get_next_anchor (first_sibling=0xffff2404fb00, new_node=0xffff2403c020) at /usr1/libyang/src/tree_data.c:510
#8  0x0000ffff818f989c in lyd_insert_node (parent=0x0, first_sibling_p=0xffff8183e0a0, node=0xffff2403c020, last=0 '\000') at /usr1/libyang/src/tree_data.c:662
#9  0x0000ffff81918750 in lydjson_maintain_children (parent=0x0, first_p=0xffff8183e0a0, node_p=0xffff8183de40, last=0 '\000', ext=0x0) at /usr1/libyang/src/parser_json.c:932
#10 0x0000ffff8191a69c in lydjson_subtree_r (lydctx=0xffff241acc70, parent=0x0, first_p=0xffff8183e0a0, parsed=0xffff8183dfb8) at /usr1/libyang/src/parser_json.c:1665
#11 0x0000ffff8191ab94 in lyd_parse_json (ctx=0xffff2c000d80, ext=0xffff2c063418, parent=0x0, first_p=0xffff8183e0a0, in=0xffff240071c0, parse_opts=65536, val_opts=2, int_opts=32, parsed=0xffff8183dfb8, subtree_sibling=0xffff8183dfaf "", 
    lydctx_p=0xffff8183dfc8) at /usr1/libyang/src/parser_json.c:1767
#12 0x0000ffff818f7c38 in lyd_parse (ctx=0xffff2c000d80, ext=0xffff2c063418, parent=0x0, first_p=0xffff8183e0a0, in=0xffff240071c0, format=LYD_JSON, parse_opts=65536, val_opts=2, op=0x0) at /usr1/libyang/src/tree_data.c:128
#13 0x0000ffff818f8084 in lyd_parse_ext_data (ext=0xffff2c063418, parent=0x0, in=0xffff240071c0, format=LYD_JSON, parse_options=65536, validate_options=2, tree=0xffff8183e0a0) at /usr1/libyang/src/tree_data.c:193

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:bugBug description.status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions