Commit Graph

35 Commits

Author SHA1 Message Date
Darius Davis 82b203dfee tvbtest: Test offsets returned by tvb_find on subsets.
This change extends tvbtest.c to validate the behavior of tvb_find_XXX and
tvb_ws_mempbrk_pattern_guint8 when used on subsets of composite tvbs (see issue
17245).

Without the fix for that issue, the test fails with:

13: Failed TVB=Subset of Composite Wrong offset for guint8:01, got 1, expected 0

With the fix, the test passes.
2021-04-03 15:12:20 +00:00
Anders Broman ca41ee2aed tests: Try to squelch [-Wpointer-sign] warnings.
Change-Id: I78bba8e39c14c1f6c5b31a79e327cbaf21473a17
Reviewed-on: https://code.wireshark.org/review/37633
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-01 10:01:39 +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
Peter Wu 281dd22da9 tvb: gracefully handle reading 0 bytes from an empty buffer
proto_tree_add_item with a zero length argument could end up calling
tvb_get_ptr to retrieve the (empty) backing buffer. This empty tvb was
possibly the result of bad reassembly, but let's gracefully handle it to
avoid a dissector exception.

Call trace for the original exception (only present on the first pass):

    proto_report_dissector_bug (format=0x7ffffffecea0 "") at epan/proto.c:1368
    ensure_contiguous_no_exception (tvb=0x6060001a5460, offset=0, length=0, pexception=0x7ffffffed060) at epan/tvbuff.c:775
    ensure_contiguous (tvb=0x6060001a5460, offset=0, length=0) at epan/tvbuff.c:785
    tvb_get_ptr (tvb=0x6060001a5460, offset=0, length=0) at epan/tvbuff.c:906
    subset_get_ptr (tvb=0x607000194b90, abs_offset=0, abs_length=0) at epan/tvbuff_subset.c:58
    ensure_contiguous_no_exception (tvb=0x607000194b90, offset=0, length=0, pexception=0x7ffffffed3c0) at epan/tvbuff.c:773
    ensure_contiguous (tvb=0x607000194b90, offset=0, length=0) at epan/tvbuff.c:785
    tvb_get_ptr (tvb=0x607000194b90, offset=0, length=0) at epan/tvbuff.c:906
    proto_tree_set_bytes_tvb (fi=0x608000535ca0, tvb=0x607000194b90, offset=0, length=0) at epan/proto.c:3862
    proto_tree_new_item (new_fi=0x608000535ca0, tree=0x604000543150, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/proto.c:2318
    proto_tree_add_item_new (tree=0x604000543150, hfinfo=0x7ffff30e91f8, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/proto.c:3381
    proto_tree_add_item (tree=0x604000543150, hfindex=65120, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/proto.c:3391
    dissect_body_data (tree=0x604000543150, pinfo=0x614000000a58, tvb=0x607000194b90, start=0, length=0, encoding=0) at epan/dissectors/packet-http2.c:1974

Change-Id: Icfae83d61ddcc9e26f16eab7f6e0e84e2f0d73ac
Reviewed-on: https://code.wireshark.org/review/29851
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-27 04:32:54 +00:00
Gerald Combs 57a397bded tvbtest: Remove an unused function.
It looks like "skip" hasn't been required since 2011.

Change-Id: Idaf53943519fa76e362aaecc6999f9971a359348
Reviewed-on: https://code.wireshark.org/review/29643
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-13 03:56:08 +00:00
Alexis La Goutte 794d1bb58d tvbtest: fix no previous prototype for ‘test/skip/run_tests’ [-Wmissing-prototypes]
Change-Id: I21a2a0edc4cb96d4d757e4d6e9c38d7fc922afc8
Reviewed-on: https://code.wireshark.org/review/29631
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-12 11:40:40 +00:00
Guy Harris d5dc4677ed Update some comments.
We no longer have TVBUFF_ values corresponding to different types of
tvbuff; we have, instead, a set of method pointers for the different
types.  Refer to the types by name, rather than by TVBUFF_ value.

Expand the description of some fields in the tvbuff structure.

Change-Id: I38b5281df247ddd66b4e39abfc129053a012d241
Reviewed-on: https://code.wireshark.org/review/27036
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-20 02:58:36 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Guy Harris 7cd6906056 Rename tvb_new_subset() to tvb_new_subset_length_caplen().
This emphasizes that there is no such thing as *the* routine to
construct a subset tvbuff; you need to choose one of
tvb_new_subset_remaining() (if you want a new tvbuff that contains
everything past a certain point in an existing tvbuff),
tvb_new_subset_length() (if you want a subset that contains everything
past a certain point, for some number of bytes, in an existing tvbuff),
and tvb_new_subset_length_caplen() (for all other cases).

Many of the calls to tvb_new_subset_length_caplen() should really be
calling one of the other routines; that's the next step.  (This also
makes it easier to find the calls that need fixing.)

Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b
Reviewed-on: https://code.wireshark.org/review/19597
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-10 06:19:37 +00:00
Michael Mann 9397b262e9 tvbtest.c - Fix printf style argument types
Change-Id: I05ecbd06262e0dd68851dd6728817ad721a91962
Reviewed-on: https://code.wireshark.org/review/16449
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-15 01:49:33 +00:00
Evan Huus 9b5b7c1a90 Remove deprecated tvb_length calls
Trust that the files in epan/ immediately (not dissectors) know what they're
doing so just blindly convert them to captured length.

Change-Id: I872f7d58b2e15ae82c75fd56f4873996fbc97be7
Reviewed-on: https://code.wireshark.org/review/9083
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-24 00:31:25 +00:00
Bill Meier 23e78cd6bd Add editor modelines; Adjust whitespace as needed.
Change-Id: I3dc57f4c2ca57585103e3b71503ac4c332903e50
Reviewed-on: https://code.wireshark.org/review/4594
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-10 14:50:08 +00:00
Evan Huus 3557ac4ec6 Fix warnings in test binaries
They aren't built with the same warning flags as normal, but if you add those
flags a bunch of warnings show up.

Change-Id: If3776fbd98cc45e473f055e07c86ea8f6a5034f7
Reviewed-on: https://code.wireshark.org/review/2432
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-19 18:24:09 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Jakub Zawadzki 5ac6474c94 Rename some of pint.h macros to match common style (bits number on the end).
pntohs  -> pntoh16
   pntohl  -> pntoh32
   pletohs -> pletoh16
   pletohl -> pletoh32
   phtons  -> phton16
   phtonl  -> phton32


svn path=/trunk/; revision=53652
2013-11-29 18:59:06 +00:00
Jakub Zawadzki ea478f2c5e missing include for tvbtest + add 'const' (silent most of warnings).
svn path=/trunk/; revision=53222
2013-11-10 13:04:21 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Evan Huus 9afac168a7 Update to tvb_g_memdup in tvb test suite.
svn path=/trunk/; revision=52165
2013-09-21 17:37:31 +00:00
Jeff Morriss 2df54da6e2 Move a bunch of the crypt modules and pint.h into wsutil.
This means wsutil now links against libcrypt.

Protect a bunch of the crypt header files from multiple inclusion.

svn path=/trunk/; revision=51100
2013-08-01 23:34:47 +00:00
Guy Harris c0c15029ed Add to tvbuffs a "fragment length" field; if the tvbuff represents the
first fragment of a non-reassembled packet, and we know the length the
packet would have if it were reassembled, this field holds the length of
the fragment, and the "reported length" field shows the length the
packet would have if it were reassembled, so going past the end of the
fragment but staying within the length of the reassembled packet can be
reported as "dissection would have worked if the packet had been
reassembled" rather than "the packet is too short, so it was probably
malformed".

Add a FragmentBoundsError exception, thrown in the "dissection would
have worked if the packet had been reassembled" case.

Add a new tvb_new_subset_length_fragment() routine to create a new
subset tvb with specified fragment and reported lengths.  Use it in the
CLNP dissector.

Add some more sanity checks in the CLNP dissector.

svn path=/trunk/; revision=48917
2013-04-18 19:22:24 +00:00
Bill Meier 25a1d9d667 Remove obsolete & incorrect comment:
/* Composite tvbuffs don't work at the moment -- tests commented out until
 * they do. */


svn path=/trunk/; revision=45830
2012-10-29 16:19:31 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Bill Meier 9708878fa3 Rework some code in tvbtest to fix an issue when testing composite tvbs.
tvbtest now completes all the tvb tests successfully (including those for composite tvbs) !!

In addition, running tvbtest under valgrind shows no memory leaks.


svn path=/trunk/; revision=40269
2011-12-21 23:42:17 +00:00
Bill Meier a15064f02f Fix a Windows compile error.
svn path=/trunk/; revision=40268
2011-12-21 21:49:10 +00:00
Bill Meier 522950401f Add code to allow tvbuff memory leak testing (using valgrind, for example).
Essentially: tvbtest.c patch from Robert G. Jakabosky:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6573

Also: Update tvbtest code slightly to reflect the revised tvbuffs code
committed in SVN #40264;
 (Composite tvbs should not be individually freed).


svn path=/trunk/; revision=40267
2011-12-21 21:40:25 +00:00
Gerald Combs 49b92440de More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

svn path=/trunk/; revision=37978
2011-07-11 20:32:19 +00:00
Anders Broman 6cef8aa872 From jakub Zawadzki:
I've fixed composite tests #0 and #2

svn path=/trunk/; revision=36440
2011-04-04 05:48:06 +00:00
Richard van der Hoff d522b25216 From me: make tvbtest return an exitcode appropriate to its success
svn path=/trunk/; revision=21308
2007-04-03 01:53:52 +00:00
Richard van der Hoff 96058b34bc From me:
disable failing composite tvb tests

svn path=/trunk/; revision=21307
2007-04-03 01:49:14 +00:00
Richard van der Hoff 606a756714 From me:
fix compiler warnings in tvbtest.c

svn path=/trunk/; revision=21306
2007-04-03 01:45:59 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Jörg Mayer 48be4e530d Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6116
2002-08-28 20:41:00 +00:00
Gilbert Ramirez f14a6b8b91 Hopefully the last time I have to change my e-mail address.
svn path=/trunk/; revision=4199
2001-11-13 23:55:44 +00:00
Gilbert Ramirez 83ec54675c First step in moving core Ethereal routines to libepan.
svn path=/trunk/; revision=2458
2000-09-27 04:55:05 +00:00