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

Wireshark-users: [Wireshark-users] [patch] error in ProtoField lua code prevents mask being speci

From: Sam Roberts <vieuxtech@xxxxxxxxx>
Date: Wed, 3 Jun 2009 15:01:18 -0700
The underlying cause is that value_string_from_table()'s use of the
lua stack is not balanced, if a table is iterated, it pops one more
time than it should.

The user-visible effect is that code such as:

  ProtoField.uint8( "wihart.addrspec.dst64", "dst64", base.HEX,
{[0x40]="yes", [0x0]="no"}, 0x40)

will always set the mask to 0, because the the mask is popped when the
value/string table is processed.

I did a (very) quick grep, and didn't see this bug in the other places
lua_next() is called, but it might be worth reviewing further.

Index: epan/wslua/wslua_proto.c
===================================================================
--- epan/wslua/wslua_proto.c    (revision 28617)
+++ epan/wslua/wslua_proto.c    (working copy)
@@ -516,7 +516,7 @@
         lua_pop(L, 1);
     }

-    lua_pop(L, 1);
+/*  lua_pop(L, 1); */

     ret = (value_string*)vs->data;