Wireshark-bugs: [Wireshark-bugs] [Bug 12046] New: TvbRange:raw() does not really return a subset

Date: Mon, 25 Jan 2016 16:30:37 +0000
Bug ID 12046
Summary TvbRange:raw() does not really return a subset
Product Wireshark
Version Git
Hardware All
OS All
Status UNCONFIRMED
Severity Normal
Priority Low
Component Dissection engine (libwireshark)
Assignee [email protected]
Reporter [email protected]
CC [email protected]

Created attachment 14275 [details]
LUA dissector that reproduces the unexpected TvbRange:raw value

Build Information:
TShark (Wireshark) 2.1.0 (v2.1.0rc0-1526-g7002a9c from master)
(also reproduced for 2.0.1)

Copyright 1998-2016 Gerald Combs <[email protected]> and contributors.
License GPLv2+: GNU GPL version 2 or later
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with libpcap, with POSIX capabilities (Linux), with libnl 3,
with libz 1.2.8, with GLib 2.46.2, without SMI, without c-ares, without ADNS,
with Lua 5.2, with GnuTLS 3.4.7, with Gcrypt 1.6.4, with MIT Kerberos, with
GeoIP.

Running on Linux 4.3.0-custom, with locale en_GB.UTF-8, with libpcap version
1.7.4, with libz 1.2.8, with GnuTLS 3.4.8, with Gcrypt 1.6.4.
Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz (with SSE4.2)

Built using clang 4.2.1 Compatible Clang 3.7.0 (tags/RELEASE_370/final).
--
TvbRange:raw is documented[1] as returning the lua string representation for a
range, but somehow it returns the full backing data instead of the subset.
Adapted from the reproducer:

    local range = tvb(2, 3)
    local range_raw = range:raw()
    assert(string.len(range_raw) == 3) -- currently fails


Reproducer (tested on an Ethernet capture):

    tshark -Xlua_script:tvbrange_raw.lua -c1 -O test -r some.pcap

Expected output:

    ...
    test proto
        Range:       ffffff
        Range (raw): FFFFFF
        Expected:    FFFFFF

Actual output:

    ...
    test proto
        Range:       ffffff
         [truncated]Range (raw): FFFFFFFFFFFF80FA5B2329230...
        Expected:    FFFFFF
    Lua Error: [string "tvbrange_raw.lua"]:13: assertion failed!

--
 [1]:
https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Tvb.html#lua_fn_tvb_raw__offset____length__


You are receiving this mail because:
  • You are watching all bug changes.