* Null pointer dereference?
@ 2017-05-12 15:45 Zubin Mevawalla
2017-05-12 19:17 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Zubin Mevawalla @ 2017-05-12 15:45 UTC (permalink / raw)
To: emacs-devel
I was curious if this was a real null pointer dereference issue, in
etags.c on line 2265?
`np_parent` is initialized to NULL on 2248. if `np` is not NULL and
`np->fdp == badfdp` then `np_parent->left` on line 2265 would result
in a null pointer dereference.
CodeAi, an automated repair tool being developed at Qbit logic,
suggested a condition tightening as a fix.
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 015cbbe..1f50d06 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -2260,7 +2260,7 @@ invalidate_nodes (fdesc *badfdp, node **npp)
np_parent = np;
np = np->left;
}
- if (np)
+ if (np_parent && (np))
{
np_parent->left = np->left; /* detach subtree from the tree */
np->left = NULL; /* isolate it */
Could I submit this as a patch if it looks alright?
Thanks so much,
Zubin
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Null pointer dereference?
2017-05-12 15:45 Null pointer dereference? Zubin Mevawalla
@ 2017-05-12 19:17 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2017-05-12 19:17 UTC (permalink / raw)
To: Zubin Mevawalla; +Cc: emacs-devel
> From: Zubin Mevawalla <zubinmeva@qbitlogic.com>
> Date: Fri, 12 May 2017 11:45:53 -0400
>
> I was curious if this was a real null pointer dereference issue, in
> etags.c on line 2265?
I don't think so.
> `np_parent` is initialized to NULL on 2248. if `np` is not NULL and
> `np->fdp == badfdp` then `np_parent->left` on line 2265 would result
> in a null pointer dereference.
np->fdp == badfdp cannot happen the first time the loop condition is
tested, because np was initialized to point to super_root, and
super_root.fdp was initialized to -1, which can never be equal to
badfdp.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-12 19:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12 15:45 Null pointer dereference? Zubin Mevawalla
2017-05-12 19:17 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).