Commit Graph

883 Commits

Author SHA1 Message Date
Stig Bjørlykke d104571e8a Lua: Improve Listener error handling
Fix error handlers in Listener draw() and reset() to avoid getting
LUA_ERRERR from lua_pcall(). Added error handler for Listener draw()
callback.

Handle LUA_ERRERR from lua_pcall() to avoid assert on this.
Changed some capitalized words in various error message.

Closes #16974.
2020-12-04 13:38:00 +00:00
David Perry 27c00ca0e9 Lua: make TvbRange:raw() return a subset #12046 v2
My initial fix caused several double-offset errors in TvbRange_raw()
because I was adjusting for the TvbRange's offset too early in the
process. The proper fix is to only adjust for it in the final call to
get the data.

I also simplified some of the bounds checks to be based on the values in
the TvbRange instead of calling `tvb_captured_length()` and the like,
because its bounds are already checked against the backing Tvb when it's
first taken.

Massively expanded the lua test suite to account for every combination
of passing offsets and lengths to a Tvb or TvbRange and to the
subsequent `:raw()` call.
2020-12-02 20:09:55 +00:00
John Thacker 15d315c2ae GLib: Bump requirement 2.32 -> 2.36 2020-11-25 06:25:38 +00:00
Stig Bjørlykke ebfa1f8a4b wslua: Return nil from Dissector.get() when not found
Return nil from Dissector.get() and DissectorTable.get() when the
reference is not found. This can be used to check for existence of
a dissector or dissector table before use.

We already do this for DissectorTable.get_dissector().
2020-11-05 06:23:24 +00:00
Stig Bjørlykke 10e6cb5f37 wslua: Make pinfo.p2p_dir writable
Make pinfo.p2p_dir writeble from Lua to be able to set the direction
for sub-dissectors.
2020-10-22 14:18:58 +00:00
David Perry c03011b906 Lua: base64_decode: handle unpadded data
As noted in bug #16386, glib's `g_base64_decode_inplace()` aborts
decoding of base64 strings that aren't padded. This addresses that by
adding padding "=" characters if needed to the buffer which will be
decoded.

I added the test case from the bug report to the test suite, though the
location therein may not be ideal.

Closes #16386
2020-10-19 08:38:31 +00:00
Guy Harris 6e6233521a Have WTAP_ERR_INTERNAL include an err_info string giving details.
That way, users won't just see "You got an internal error", the details
will be given, so they can report them in a bug.
2020-10-14 04:51:45 +00:00
Guy Harris 7b5b6501f0 Revert "No need for a local lua_State * variable in file handler routines."
This reverts commit 873e079659.

That change didn't help what I wanted to do; there's another way to do
it.
2020-10-13 17:54:50 -07:00
Guy Harris 873e079659 No need for a local lua_State * variable in file handler routines.
Just use fh->L; the compiler will put that into a register if
appropriate.  This removes one side-effect from
INIT_FILEHANDLER_ROUTINE().
2020-10-13 13:30:52 -07:00
Guy Harris e013c5ec7f Clean up URLs.
Add ui/urls.h to define some URLs on various of our websites.  Use the
GitLab URL for the wiki.  Add a macro to generate wiki URLs.

Update wiki URLs in comments etc.

Use the #defined URL for the docs page in
WelcomePage::on_helpLabel_clicked; that removes the last user of
topic_online_url(), so get rid of it and swallow it up into
topic_action_url().
2020-10-02 20:13:42 -07:00
Chuck Craft 4a0d8d4ef6 Qt: point to Lua wiki page now on Gitlab 2020-10-02 17:25:54 +00:00
Guy Harris 272502790b Add FT_STRINGZTRUNC.
FT_STRINGZPAD is for null-*padded* strings, where the field is in an
area of specified length, and, if the string is shorter than that
length, all bytes past the end of the string are NULs.

FT_STRINGZTRUNC is for null-*truncated* strings, where the field is in
an area of specified length and, if the string is shorter than that
length, there's a null character (which might be more than one byte, for
UCS-2, UTF-16, or UTF-32), and anything after that is not guaranteed to
have any particular value.

Use IS_FT_STRING() in some places rather than enumerating all the string
types, so that those places get automatically changed if the set of
string types changes.
2020-09-12 14:16:12 -07:00
Gerald Combs 7ab6440416 Tools: Clean up checkAPI and add ui/qt.
Remove the --check-addtext and --build flags. They were used for
checkAddTextCalls, which was removed in e2735ecfdd.

Add the sources in ui/qt except for qcustomplot.{cpp,h}. Fix issues in
main.cpp, rtp_audio_stream.cpp, and wireshark_zip_helper.cpp.

Rename "index"es in packet-usb-hid.c.
2020-09-05 07:41:29 +00:00
Guy Harris 74e917fc6c wiretap: have wtap_dump_flush(), and its callers, check for errors.
Change-Id: Ibcddf1a949f775afa49d36a2d165c3685556035d
Reviewed-on: https://code.wireshark.org/review/38104
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-09 23:08:51 +00:00
Guy Harris 3a8111e1c2 Lua: give better errors for more WTAP_ERR_ types from wtap_dump_open().
Change-Id: I9878baebb78a36f306ae87b802680dc35875e862
Reviewed-on: https://code.wireshark.org/review/38041
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-04 09:36:08 +00:00
Gerald Combs bd11d5b90b wslua: Include stdint.h on Windows.
The Universal CRT supplies stdint.h, so there's no reason to define our
own types.

Change-Id: I40d4216136aaecae1dc07b0b32ac31032a74b632
Reviewed-on: https://code.wireshark.org/review/37648
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-01 20:23:22 +00:00
rbroker 1f75d7b3b9 wslua: Add ability to query current temporary color filter text
The LUA API provides the "set_color_filter_slot" function, but without
a corresponding "get_" function, it's very hard for two LUA dissectors
to co-exist without one overwriting any color filters set by the other.

It also looks like the documentation comment for
"set_color_filter_slot" had an off-by-one error, which I've corrected
as I was adding almost identical documentation for the new API.

Change-Id: Ic54d23be555ec12e1830bbe6f84a1b04d04fd4f0
Reviewed-on: https://code.wireshark.org/review/37511
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-25 08:02:27 +00:00
Gerald Combs da04d89f1e wslua: Update the ByteArray and Tvb docs.
Add content from https://wiki.wireshark.org/LuaAPI/ByteArray and
https://wiki.wireshark.org/LuaAPI/Tvb. Update as needed.

Remove an extraneous trailing semicolon.

Change-Id: I857b748821c21413ecb563c150525575fc9b947a
Reviewed-on: https://code.wireshark.org/review/36635
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-31 04:13:01 +00:00
Gerald Combs ed3fe162bd wslua: Update the Int64 docs.
Add content from https://wiki.wireshark.org/LuaAPI/Int64. Update as
needed.

Change-Id: I6a5f8c1cdeddee6d552fde940224704daca980b5
Reviewed-on: https://code.wireshark.org/review/36639
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-31 04:12:48 +00:00
Gerald Combs 99798d2c1c wslua: Update the Dir and Utils docs.
Add content from https://wiki.wireshark.org/LuaAPI/Utils. Update as
needed.

Change-Id: I2bf04d053a1edd5e05779c5a41e5ae0fbcb71b54
Reviewed-on: https://code.wireshark.org/review/36638
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-31 04:12:35 +00:00
Gerald Combs 6f59b8e84d wslua: Cross-reference and title case fixes.
Use lua_class_DissectorTable instead of lua_class_DissectorTables.

Use title case for each module.

Change-Id: Ie855022ee59a857c8ced7c3e6ba070ab494fa017
Reviewed-on: https://code.wireshark.org/review/36634
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-03-30 16:42:18 +00:00
Gerald Combs e53cb23b1f wslua: Update the packet information docs.
Add content from https://wiki.wireshark.org/LuaAPI/Pinfo and update as
needed.

Change-Id: Ia0b61b529c2a83d6dca8244916154cdc86289a79
Reviewed-on: https://code.wireshark.org/review/36628
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-03-30 16:08:37 +00:00
Gerald Combs 48407df448 wslua: Update the TreeItem docs.
Add content from https://wiki.wireshark.org/LuaAPI/TreeItem and update
as needed.

Change-Id: I59ae271bb6b77d3df1bf53e175a4eccbcf9049f6
Reviewed-on: https://code.wireshark.org/review/36630
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-30 08:55:42 +00:00
Gerald Combs 87be7fa23c wslua: Update the dissector docs.
Add content from https://wiki.wireshark.org/LuaAPI/Dissector,
https://wiki.wireshark.org/LuaAPI/Pref, and
https://wiki.wireshark.org/LuaAPI/Proto. Update as needed.

Change-Id: I74a167feb9db0fcdb723501e4692da020db1ab2c
Reviewed-on: https://code.wireshark.org/review/36629
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-30 08:55:19 +00:00
Gerald Combs 23a947073b wslua: Update the Listener docs.
Add content from https://wiki.wireshark.org/LuaAPI/Listener and update
as needed.

Add an example that dumps valid listener names.

Change-Id: I009eaa83c645b5ad78b560acb249a3060b2784ba
Reviewed-on: https://code.wireshark.org/review/36624
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-30 07:00:39 +00:00
Gerald Combs 1a3e64db39 wslua: Update the GUI docs.
Add content from https://wiki.wireshark.org/LuaAPI/GUI and update as
needed.

Separate some of our Asciidoctor output with newlines.

Change-Id: I2b8b9449c94bd69095fbd4b65ea415cd4d525c30
Reviewed-on: https://code.wireshark.org/review/36613
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-30 06:56:44 +00:00
Alexis La Goutte 9f5be6f7eb fix typo found by lintian (Uknown => Unknown)
Change-Id: I50ae0d1595cc42b3432f4611009c9c48b4cdde70
Reviewed-on: https://code.wireshark.org/review/36567
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-25 15:13:03 +00:00
Martin Mathieson eb439e89f1 wslua: WSLUA_BIT_OP_FUNC macro already does return .
epan/wslua/wslua_int64.c:445: style: Consecutive return, break, continue, goto or throw statements are unnecessary.
epan/wslua/wslua_int64.c:454: style: Consecutive return, break, continue, goto or throw statements are unnecessary.
epan/wslua/wslua_int64.c:463: style: Consecutive return, break, continue, goto or throw statements are unnecessary.
epan/wslua/wslua_int64.c:966: style: Consecutive return, break, continue, goto or throw statements are unnecessary.
epan/wslua/wslua_int64.c:975: style: Consecutive return, break, continue, goto or throw statements are unnecessary.
epan/wslua/wslua_int64.c:984: style: Consecutive return, break, continue, goto or throw statements are unnecessary.

Change-Id: I98d8c07cb13c523ba21469b7ad84ff4738764d49
Reviewed-on: https://code.wireshark.org/review/36556
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-03-24 12:59:27 +00:00
Moshe Kaplan 4a8da5fbde wslua: Fix crash on TvbRange:__tostring for a zero-length TVB
Fields such as 'frame.time_delta' have no byte selection, they are added
with offset 0 and length 0, and evidently 'ws_tvb' is NULL. As
tvb_bytes_to_str expects a non-NULL tvb, explicitly check for this and
add a dummy placeholder. This is intended to be a human-readable string,
so prefer `<EMPTY>` over an empty string.

Change-Id: I32efe4cbefc6bcf0fa9fb94fcf25d7bf1628f3a7
Reviewed-on: https://code.wireshark.org/review/36440
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-03-16 22:42:03 +00:00
Markku Leiniö 166c06ff15 Lua: Fix description for pinfo.dst_port
Change-Id: If0f6aeb357f0267cdf13763e7710ea221cc2600c
Reviewed-on: https://code.wireshark.org/review/36355
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-03-10 08:39:57 +00:00
Moshe Kaplan b7566bf40f LUA: remove duplicate words
Change-Id: Id3c5b1d7f67d8e4d3149ed6bdee7307bf13fda3d
Reviewed-on: https://code.wireshark.org/review/36263
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-03-03 07:37:30 +00:00
Gerald Combs d614ade782 De-camel-ize "Wireshark" in a few places.
The _wslua_main struct / WireShark class appears to have never been
used, so remove it.

Change-Id: Id80fb2c2065accedf632ea4cc467d566d10870de
Reviewed-on: https://code.wireshark.org/review/35480
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-12-18 04:31:03 +00:00
Stig Bjørlykke 8afd7a751f funnel: Free callback data
Free one more allocated callback data in TextWindow. This is needed
because text_win_close_cb() is also doing the same as TextWindow__gc().

Bug: 16177
Change-Id: I7c2211e154a6db1dccd22df824e76cce575040c9
Reviewed-on: https://code.wireshark.org/review/34990
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-11-05 17:15:42 +00:00
Stig Bjørlykke 499d912f4b funnel: Free callback data
Free allocated callback data in FunnelStringDialog, TextWindow and
registered menu items. Also free strings used in FunnelStringDialog.

Bug: 16177
Change-Id: I9a129b8975a55d1dc89fe851116feebe82763bca
Reviewed-on: https://code.wireshark.org/review/34945
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-11-05 15:21:30 +00:00
Stig Bjørlykke 541afedfbc wslua: Fix memleak of unregistered ProtoExpert
If a ProtoExpert object was created, but not linked to a Proto, then the
object and some fields (abbrev, text) would leak.

This is a follow-up to g79fef2ae.

Change-Id: Ic0b44e8b70895a19d9b52a0e44064a1e76a58fa0
Reviewed-on: https://code.wireshark.org/review/34876
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-28 16:16:49 +00:00
Stig Bjørlykke 551745998e wslua: Fix memleak of unregistered ProtoField strings
If a ProtoField object was created, but not linked to a Proto, then the
strings field and all elements (depending on type) would leak.

This is a follow-up to g79fef2ae and fixes the real issue in g44870fb1.

Change-Id: I01880a92bb20fae45f68c754b07daeb07630deec
Reviewed-on: https://code.wireshark.org/review/34872
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-28 15:05:54 +00:00
Stig Bjørlykke 0371994223 wslua: Improve parameter check in ProtoField.new()
Improve paremeter check in ProtoField.new() when using ftypes.CHAR:
- Check valid base types and give an error when not supported instead of
  terminate in a g_error() (base.DEC is not supported).
- Give an error if used with base.UNIT_STRING instead of silently remove
  the flags.
- Support base.RANGE_STRING instead of removing the flag.

Support using base.NONE with a valuestring.
Add ftypes.CHAR to the list of supported types.

Change-Id: I0e3f9698074c807f5da0de23ccd1be7446271135
Reviewed-on: https://code.wireshark.org/review/34783
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-16 07:41:11 +00:00
Stig Bjørlykke 3a9933c52f wslua: Add ProtoField.char()
ProtoField.new() already support ftypes.CHAR, so add ProtoField.char()
to complete the support for FT_CHAR in Lua.

Change-Id: I0568f874fd667f834584a07af14bdda9bb03856b
Reviewed-on: https://code.wireshark.org/review/34784
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-16 07:40:39 +00:00
Stig Bjørlykke efe1b0b1b2 Lua: Use space for indent
Remove use of TAB.

Change-Id: Ic2a08f6b325e1fc52a5b043aa09e8f98dacd8c5e
Reviewed-on: https://code.wireshark.org/review/34780
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-10-15 07:58:27 +00:00
Stig Bjørlykke 8e3ed86de7 Lua: Support FT_CHAR in Field
Add support for fetching FT_CHAR field values.

Bug: 16129
Change-Id: I0e3b0c784277e259fb7cd1725254fc7a723f6d1e
Reviewed-on: https://code.wireshark.org/review/34775
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-10-14 17:39:25 +00:00
Guy Harris 22e7952e06 HTTPS In Even More Places, update some links.
Fall back on the Wayback Machine for some links.

Change-Id: I6a44a2caaeb4fa521c2f08196e7c36069e3bb842
Reviewed-on: https://code.wireshark.org/review/34103
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-28 04:21:18 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Martin Kaiser 429082dd71 wslua: pinfo: make p2p_dir accessible to lua dissectors
Some dissectors populate pinfo->p2p_dir with a packet's direction
(incoming / outgoing). Make this info available to lua dissectors.

Add a simple test for Pinfo's new p2p_dir attribute to the wslua
test suite. It checks that p2p_dir is unknown for dhcp packets.
(The dhcp dissector does not set p2p_dir).

Change-Id: I8cc39a11cff840d10ef7fa94d30cbac8bf9b533f
Reviewed-on: https://code.wireshark.org/review/33935
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2019-07-22 15:45:27 +00:00
Peter Wu a80b4fdd40 Lua: remove lua_data_handle
Use call_data_dissector directly for the same effect as lua_data_handle.

Remove the special case where DissectorTable.get_dissector() returns the
data dissector for an unsupported type. The documentation says that nil
is returned if the handle is not found, that seems more appropriate.

Change-Id: I128ef90b79bda925a4329202a0b9956e1cf16200
Reviewed-on: https://code.wireshark.org/review/34032
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2019-07-21 17:00:18 +00:00
Martin Kaiser bfad6f03d6 wslua: add a Proto parameter to DissectorTable.new()
Add an optional paramter of type Proto to DissectorTable.new().
If the caller provides a Proto, we can get the protocol id and
use it when we register the dissector table.

Change-Id: I3ab0819c41fa97288ec962d8d495b63d4750ce4b
Reviewed-on: https://code.wireshark.org/review/33608
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-16 02:39:18 +00:00
Martin Kaiser 13795914a1 wslua: clean up DissectorTable_new()
Reorder the code to have a single return statement at the end.
Take advantage of the fact that WSLUA_OPTARG_ERROR terminates
the C function that called it.

Do only the parameter checks in the switch-case statement.

Get rid of the intermediate steps when we copy name and ui_name.

Change-Id: Ie8917d19589a6ee16a4a5d14f2c1711d35cc8114
Reviewed-on: https://code.wireshark.org/review/33607
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-16 02:15:05 +00:00
Martin Kaiser bf8bc8e007 wslua: add support for ft_none dissector tables
The C code introduced ft_none dissector tables some time ago. They have
no indicator to select the next protocol, only Decode As is supported
for them.

Allow lua code to create ft_none dissector tables as well. The patch
is trying to make as few changes as possible to DissectorTable_new().

Change-Id: Ie3ff58f092e6922ab7878d202c7484a64b2430a3
Reviewed-on: https://code.wireshark.org/review/33588
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-14 13:39:27 +00:00
Martin Kaiser a3481933f9 wslua: fix error handling for invalid dissector table
Calling DissectorTables's try method for a dissector table of an unknown
type crashes Wireshark.

local dt = DissectorTable.get("iso14443.subdissector")
dt:try(0, tvbuf, pinfo, tree)

causes a segmentation fault

Thread 1 "wireshark" received signal SIGSEGV, Segmentation fault.
except_pop () at /media/sf_wireshark.git/epan/except.c:264
264       set_top(top->except_down);
(gdb) print top
$1 = (struct except_stacknode *) 0x2
(gdb) bt
    at /media/sf_wireshark.git/epan/packet.c:590

My gut feeling (I haven't verified this) is that we should not call luaL_error()
inside a TRY-CATCH block. DissectorTable_try does this when the type of the
dissector table is not supported.

Fall back to the data dissector in this case and bring up an expert info
instead of aborting the dissection completely.

Change-Id: I9a49f738a99b2618014f41050d8c0bf6bfbb4138
Reviewed-on: https://code.wireshark.org/review/33357
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-26 13:08:38 +00:00
Martin Kaiser 0ab91dd96a wslua: print the correct type for FT_NONE dissector tables
We added FT_NONE dissector tables a while ago. These tables can only be
used for Decode As. Support such dissector tables in lua's print() function.

print(DissectorTable.get("iso14443.subdissector"))

will now print

DissectorTable iso14443.subdissector only for Decode As:

Change-Id: I9f5a2f6d6b1edb2a53ca1d2c0ae158c16fddf05f
Reviewed-on: https://code.wireshark.org/review/33356
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-26 06:32:58 +00:00
Alexis La Goutte 92dede59a5 wslua(pinfo): fix typo
Change-Id: Ifc808baf3ea495f632be00bcfb122b78d80a7854
Reviewed-on: https://code.wireshark.org/review/33267
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-20 07:37:56 +00:00