Ethereal-dev: [Ethereal-dev] Null OID passed to call_ber_oid_callback()

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Fri, 18 Nov 2005 02:16:26 -0800
The Ethereal builds were crashing on tests - the CMIP dissector was passing a null OID to call_ber_oid_callback() when run with the snoop.cap dissector from

	http://www.ethereal.com/lists/ethereal-users/200506/msg00263.html

I checked in a change to keep it from crashing in that case, but the packets are either malformed or being misdissected:

BER Error: Wrong field in sequence expected class:0 (Universal) tag:6(OBJECT IDENTIFIER) but found class:2(Context Specific) tag:6
        BER: No OID supplied to call_ber_oid_callback
            [16]  (len:54 bytes)
                ENUMERATED: 1
                [17]  (len:44 bytes)
                    [16]  (len:19 bytes)
                        BER: Error can not handle universal tag:0
                        [2]  (len:3 bytes)
                            ENUMERATED: 12
                            [16]  (len:21 bytes)
                                BER: Error can not handle universal tag:0
                                [2]  (len:3 bytes)
                                    BOOLEAN: 0x00
                                    INTEGER: 104756

in packet 1813, for example.

Should it do a DISSECTOR_ASSERT() check on the OID passed in, so that it's reported as a dissector bug? One might argue that the caller of call_ber_oid_callback() might know better what to do when an expected OID is missing, although if it's missing because the packet is malformed, that's not the result of a dissector problem (if the packet is genuinely malformed).

Also, as we're using a lot of global variables in ASN.1 dissectors, perhaps they should all be reset when the dissection starts?

(Perhaps at some point the .cnf file should have directives to specify all the global state variables required to allow one field to be processed when dissecting another field - and perhaps, instead of storing that state in global variables, a data structure containing the state variables should be allocated on the stack in the main dissector, and a pointer to it passed to the subdissectors.)