代码拉取完成,页面将自动刷新
From a3917d95d516e3de267d3cfa5d4d3715a90e8777 Mon Sep 17 00:00:00 2001
From: Michal Vasko <mvasko@cesnet.cz>
Date: Mon, 8 Mar 2021 14:08:05 +0100
Subject: [PATCH] yin parser BUGFIX invalid memory access
... in case there were some unresolved
extensions.
Fixes #1454
Fixes #1455
---
src/parser_yin.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 275991644..256325415 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -4572,7 +4572,7 @@ read_yin_anydata(struct lys_module *module, struct lys_node *parent, struct lyxm
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
break;
}
@@ -4794,7 +4794,7 @@ read_yin_leaf(struct lys_module *module, struct lys_node *parent, struct lyxml_e
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
break;
}
@@ -5108,7 +5108,7 @@ read_yin_leaflist(struct lys_module *module, struct lys_node *parent, struct lyx
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
break;
}
@@ -5477,7 +5477,7 @@ read_yin_list(struct lys_module *module, struct lys_node *parent, struct lyxml_e
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
retval->flags |= LYS_VALID_EXT;
if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {
retval->flags |= LYS_VALID_EXT_SUBTREE;
@@ -5701,8 +5701,9 @@ read_yin_container(struct lys_module *module, struct lys_node *parent, struct ly
}
for (r = 0; r < retval->ext_size; ++r) {
- /* set flag, which represent LYEXT_OPT_VALID */
- if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
+ /* extension instance may not yet be resolved */
+ if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {
+ /* set flag, which represent LYEXT_OPT_VALID */
retval->flags |= LYS_VALID_EXT;
if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {
retval->flags |= LYS_VALID_EXT_SUBTREE;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。