Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Error creating custom giop dissector

Date: Wed, 4 Dec 2013 10:55:21 +0000
I mentioned this in a previous email, but nobody responded. So it may have 
got missed.

This looks like a bug, so should I raise a bug report or has it been 
addressed by recent fixes?

I am creating a custom dissector from a CORBA IDL file using omniorb....

c:\Python27\omniorb\omniORB-4.1.6\bin\x86_win32\omniidl -p 
c:\wireshark-1.10.3\tools -b wireshark_be q_quentin.idl > packet-quentin.c

I have a function declared in the IDL that looks like..

  typedef sequence <long> Longs ;
  void newThumbnail (in long ident, in long offset, in long width, in long 
height, in Longs data) ;

This produces code that looks like

    case Request:
        proto_tree_add_int(tree, 
hf_Quentin_ThumbnailListener_newThumbnail_ident, tvb, *offset-4, 4, 
get_CDR_long(tvb,offset,stream_is_big_endian, boundary));

        proto_tree_add_int(tree, 
hf_Quentin_ThumbnailListener_newThumbnail_offset, tvb, *offset-4, 4, 
get_CDR_long(tvb,offset,stream_is_big_endian, boundary));

        proto_tree_add_int(tree, 
hf_Quentin_ThumbnailListener_newThumbnail_width, tvb, *offset-4, 4, 
get_CDR_long(tvb,offset,stream_is_big_endian, boundary));

        proto_tree_add_int(tree, 
hf_Quentin_ThumbnailListener_newThumbnail_height, tvb, *offset-4, 4, 
get_CDR_long(tvb,offset,stream_is_big_endian, boundary));

        u_octet4_loop_Quentin_ThumbnailListener_newThumbnail_data = 
get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
        /* coverity[returned_pointer] */
        item = proto_tree_add_uint(tree, 
hf_Quentin_ThumbnailListener_newThumbnail_data, tvb,*offset-4, 4, 
u_octet4_loop_Quentin_ThumbnailListener_newThumbnail_data);

        for (i_Quentin_ThumbnailListener_newThumbnail_data=0; 
i_Quentin_ThumbnailListener_newThumbnail_data < 
u_octet4_loop_Quentin_ThumbnailListener_newThumbnail_data; 
i_Quentin_ThumbnailListener_newThumbnail_data++) {

            proto_tree_add_int(tree, 
hf_Quentin_ThumbnailListener_newThumbnail_data, tvb, *offset-4, 4, 
get_CDR_long(tvb,offset,stream_is_big_endian, boundary));

        }

If I run this I get an error in the dissector

Q_quentin Dissector Using GIOP API
    ident: 0
    offset: 1073
    width: 90
    height: 72
    Seq length of data: 6480

followed by..

Message: proto.c:3174: failed assertion "DISSECTOR_ASSERT_NOT_REACHED"

It looks like the variable used in the loop is wrong. This needs a new
variable creating. e.g. 

{&hf_Quentin_ThumbnailListener_newThumbnail_data_int, 
{"data","giop-q_quentin.ThumbnailListener.newThumbnail.data.int",FT_INT32,BASE_DEC,NULL,0x0,NULL,HFILL}},

and the loop changing to use this e.g. 

            proto_tree_add_int(tree, 
hf_Quentin_ThumbnailListener_newThumbnail_data_int, tvb, *offset-4, 4, 
get_CDR_long(tvb,offset,stream_is_big_endian, boundary));

This used to work in version 1.6 (the last one I've used). So something
got missed in the recent changes.

Thanks for any help sorting this.

Regards

Andy Ling