Skip to content

null-pointer failure in rb_sort_clb #2471

@w00931306

Description

@w00931306

/**

  • @brief Call plugins_types sort callback or sort values by plugin order.
  • @param[in] ctx libyang context.
  • @param[in] val1 First value to compare.
  • @param[in] val2 Second value to compare.
  • @return Negative number if val1 < val2,
  • @return Zero if val1 == val2,
  • @return Positive number if val1 > val2.
    */
    static int
    in (const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2)
    {
    assert(val1->realtype == val2->realtype);
    return val1->realtype->plugin->sort(ctx, val1, val2);
    }

we met null-poniter failure when using the interface lyds_merge, we find the val1 could be null-pointer. How should we perform a NULL check on the input parameter.

Best wishes,
ciao

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions