Hi!
On my computer, smilint RMON2-MIB leads to a segfault because, I think,
the rmon symbol is not known because of a missing MIB which leads to an
incorrect tokenRing symbol. For example, with smiquery:
MibNode: TOKEN-RING-RMON-MIB::tokenRing
OID: 32395664.0
Declaration: <value-assignment>
NodeKind: node
I think that the bogus OID is related to the segfault which happens in
checkObjects in the loop that should find the parent node which follows
an invalid pointer. I have looked around the segfault but every data is
corrupted in the core file. Even modulePtr is not correct at all.
I have taken this very small MIB :
INVALID-MIB DEFINITIONS ::= BEGIN
IMPORTS
rmon FROM NORFC-MIB;
tokenRing OBJECT IDENTIFIER ::= { rmon 10 }
END
rmon is not solvable and tokenRing is not solvable too. This does not
lead to a segfault, but I get bogus OID :
Module: INVALID-MIB
MibNode: INVALID-MIB::tokenRing
OID: 23465424.0
Declaration: <value-assignment>
NodeKind: node
I have followed the parser step by step (smiparse()). At the exit of
this function, parser.modulePtr is correct. The first object is rmon
with OID 0 and the second object is tokenRing with OID 0.10. However,
after freeNodeTree(), the second object OID becomes 0.0. I did not see
any other change.
If I comment freeNodeTree() and smiFree() and try again smiquery, I get:
Module: INVALID-MIB
MibNode: INVALID-MIB::tokenRing
OID: 0.10
ParentNode: INVALID-MIB::rmon
Declaration: <value-assignment>
NodeKind: node
Which seems correct. On the real MIB, I get:
Module: RFC1155-SMI
Module: TOKEN-RING-RMON-MIB
MibNode: TOKEN-RING-RMON-MIB::tokenRing
OID: 0.10
ParentNode: TOKEN-RING-RMON-MIB::rmon
Declaration: <value-assignment>
NodeKind: node
Which is fine too.
However, smilint still segfaults. I have tried to comment other
occurrences of the same pattern with no luck. I am not sure to grasp the
structures used by the parser but I believe that when there is no way to
link a part of the tree, it is freed. Maybe, those nodes should be
attached to some fake element in parser-smi.y instead of setting
parentPtr to NULL? I have tried to attach them to
modulePtr->firstObjectPtr without any luck.
Maybe someone can point me in the right direction to get this right?
--
GARLIC GUM IS NOT FUNNY
GARLIC GUM IS NOT FUNNY
GARLIC GUM IS NOT FUNNY
-+- Bart Simpson on chalkboard in episode 7G13