Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/avl.c
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2019-11-20 11:31:08 +0300
committerPetr Štetiar <ynezz@true.cz>2019-11-24 15:26:58 +0300
commit9b6ede0e5312071400e6b009c6b92413061bbfaa (patch)
tree0eb55dc93de5f81a5f7984562466d1a1ea3738b5 /avl.c
parentc008294a8323c8cd45decde6a97aa85df2443dac (diff)
avl: guard against theoretical null pointer dereference
clang-10 analyzer reports following: avl.c:671:25: warning: Access to field 'parent' results in a dereference of a null pointer (loaded from field 'right') node->right->parent = parent; ~~~~~ ^ Which seems to be impossible to trigger via exported AVL public API, but it could be probably trigerred by fiddling with the AVL tree node struct members manually as they are exposed. Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'avl.c')
-rw-r--r--avl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/avl.c b/avl.c
index 8d0bf65..79ea5c7 100644
--- a/avl.c
+++ b/avl.c
@@ -45,6 +45,7 @@
#include <string.h>
#include "avl.h"
+#include "assert.h"
#include "list.h"
/**
@@ -668,6 +669,7 @@ avl_delete_worker(struct avl_tree *tree, struct avl_node *node)
return;
}
+ assert(node->right);
node->right->parent = parent;
if (parent->left == node)