This is our old Q&A Site. Please post any new questions and answers at

I was writing a Custom Wireshark Dissector. But when I ran the plugin I created, by choosing packets to be Decoded as my protocol, Wireshark Crashes with Error that "Application has requested runtime to terminate it in an unusual Way".
To Debug it further I added printf statements and also ran Wireshark from Visual C++ 2008 EE in Debug Mode(by adding breakpoints). What i see is that for one of the Packets the crash occurs when I call FTYPE_LOOKUP while a call to proto_tree_add_item is made for Length Field(4 bytes) of the Protocol.
From within proto_tree_add_item(), function alloc_field_info() is Called. From here get_hfi_and_length() is called which gives hfinfo(or header field info). This hfinfo is passed to new_field_info() function and this hfinfo is assigned to hfinfo field of field_info structure inside this function. The hfinfo->type is passed then to fvalue_init(). Here FTYPE_LOOKUP(Defined in ftypes.c) is Called where it crashes.
This is maybe because the type is not correct. I see hfinfo structure having junk values. It seems PROTO_REGISTRAR_GET_NTH. Why so ? Is there some problem in the way I have registered hf array ? Kindly note nothing abnormal happens if same code is called for other Packets.

This is how I have registered hf array
proto_register_field_array(proto, hf_base, array_length(hf_base));

This question is marked "community wiki".

asked 18 Jun '11, 14:02

varun%20saxena's gravatar image

varun saxena
accept rate: 100%

I meant it seems PROTO_REGISTRAR_GET_NTH() does not give me correct hfinfo structure. What am I doing wrong ?

(18 Jun '11, 14:04) varun saxena

Problem Resolved. I had not defined the Hfinfo Array as static

permanent link
This answer is marked "community wiki".

answered 19 Jun '11, 10:03

varun%20saxena's gravatar image

varun saxena
accept rate: 100%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 18 Jun '11, 14:02

question was seen: 2,088 times

last updated: 20 Jun '11, 11:33

p​o​w​e​r​e​d by O​S​Q​A