在协议树中将32位值标记为double时,Wireshark错误

时间:2017-02-06 15:45:36

标签: wireshark wireshark-dissector

在我的自定义解剖器中,我将gint16值添加为

gint16 stmp16 = 0;
stmp16 = (gint16)tvb_get_letohs(tvb, suboffset);
proto_tree_add_int_format_value(Din_tree, hf_distanceValue, tvb, suboffset, 2, stmp16, "%lf", stmp16/100.0);
suboffset += 2;

它在数据报中正确显示16位带符号的gint16值,其标题字段描述为

&hf_distanceValue,
{ "Distance Value", "veh.in",
    FT_INT16, BASE_DEC, NULL, 0x0,
    NULL, HFILL }
},

但是,当我尝试显示32位有符号gint32值时,我收到错误

[Dissector bug, protocol CUSTOM: ..\build\epan\proto.c:4128: failed assertion "DISSECTOR_ASSERT_NOT_REACHED"]

使用tvb_get_letohl()函数

以相同方式获取值
gint32 stmp32 = 0;
stmp32 = (gint32)tvb_get_letohl(tvb, suboffset);
proto_tree_add_int_format_value(Din_tree, hf_speedValue, tvb, suboffset, 4, stmp32, "%lf", stmp32/1000000.0);
suboffset += 4;

&hf_speedValue,
{ "Speed Value", "veh.in",
    FT_INT32, BASE_DEC, NULL, 0x0,
    NULL, HFILL }
},

断言在proto_tree_add_int_format_value()失败,如果值为gint32,它在gint16情况下工作正常。

1 个答案:

答案 0 :(得分:0)

我不确定这是不是问题,但你有2个字段具有相同的过滤器名称:

"Distance Value", "veh.in"
"Speed Value", "veh.in"

通常情况下,假设您的协议缩写为"veh.distance",您会有"veh.speed""veh"之类的内容。也许首先尝试更改此问题以查看问题是否已解决?