The current libsmi parser segfaults when trying to parse a MIB file which puts
column definitions directly under the SEQUENCE OF definition (which is wrong,
there should be a SEQUENCE row entity). An example of such a MIB file is
UCD-SNMP-MIB-OLD, where 'extensibleNames' is a direct descendant of 'extensible':
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00007f1af29b1ced in _IO_vfprintf_internal (s=s@entry=0x7ffe8b90bee0, format=<optimized out>,
format@entry=0x7f1af523b868 "SEQUENCE element #%d `%s' is not a child node under `%s'", ap=ap@entry=0x7ffe8b90c060) at vfprintf.c:1637
#2 0x00007f1af29d9543 in _IO_vasprintf (result_ptr=result_ptr@entry=0x7ffe8b90c020,
format=0x7f1af523b868 "SEQUENCE element #%d `%s' is not a child node under `%s'", args=args@entry=0x7ffe8b90c060) at vasprintf.c:59
#3 0x00007f1af520de30 in smiVasprintf (strp=strp@entry=0x7ffe8b90c020, format=<optimized out>, ap=ap@entry=0x7ffe8b90c060) at smi.c:3090
#4 0x00007f1af5207d45 in printError (parser=0x7ffe8b90d7c0, id=<optimized out>, line=172, ap=ap@entry=0x7ffe8b90c060) at error.c:1126
#5 0x00007f1af52080bf in smiPrintErrorAtLine (parser=parser@entry=0x7ffe8b90d7c0, id=id@entry=194, line=<optimized out>) at error.c:1162
#6 0x00007f1af5224279 in checkObjects (modulePtr=<optimized out>, parserPtr=0x7ffe8b90c140) at parser-smi.y:578
#7 smiparse (parserPtr=parserPtr@entry=0x7ffe8b90d7c0) at parser-smi.y:1668
#8 0x00007f1af521159b in loadModule (modulename=modulename@entry=0x2be5838 "/usr/share/snmp/mibs/UCD-SNMP-MIB-OLD.mib", parserPtr=parserPtr@entry=0x0)
at smi-data.c:4658
#9 0x00007f1af520c3ba in smiLoadModule (module=0x2be5838 "/usr/share/snmp/mibs/UCD-SNMP-MIB-OLD.mib") at smi.c:931
The following patch skips this failing parent comparison:
Index: lib/parser-smi.y
===================================================================
349a350
>
350a352
> (objectPtr->typePtr->export.name == NULL ||
352c354
< objectPtr->typePtr->export.name)) {
---
> objectPtr->typePtr->export.name))) {
354a357
> objectPtr->export.name == NULL ? "N/A" :
578c581
< ((Object *)p->ptr)->export.name,
---
> "N/A",
This is only masking the symptoms though; the resulting MIB structures cannot be used.
Best regards,
Olivier Verriest