aboutsummaryrefslogtreecommitdiffstats
path: root/tools/oss-fuzzshark
AgeCommit message (Collapse)AuthorFilesLines
2018-10-20fuzzshark: integrate oss-fuzz targets in CMakePeter Wu4-725/+8
The current fuzzshark target built by CMake is not usable for fuzzing. Address this by adding a new ENABLE_FUZZER option that enables mandatory instrumentation and libFuzzer linking options for the fuzzshark binary. Create more CMake targets for specific fuzzing targets such as fuzzshark_ip and fuzzshark_ip_proto-udp. These targets are not built by default, either build individual targets or use the all-fuzzers target. Now these binaries are not specific to oss-fuzz, so move them to a new directory (perhaps the corpora can be added here in the future). oss-fuzz build.sh is simplified and reuses the CMake targets. When OSS_FUZZ is set, it will force static linking with external libraries and limit parallel linker jobs (maybe not necessary for Google's oss-fuzz builders, but my 8G/6c VM ran out of memory). Change-Id: If3ba8f60ea1f5c3bd2131223050a81f9acbce05d Reviewed-on: https://code.wireshark.org/review/30228 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-09epan: Add argument to epan_init() to disable pluginsJoão Valverde1-1/+1
Change-Id: I8dc76e6bf8c4d5a3081cbdc1d47b88e857415d29 Reviewed-on: https://code.wireshark.org/review/29498 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2018-08-31Add support for protocol aliases. Switch BOOTP to DHCP.Gerald Combs1-2/+2
Add support for aliasing one protocol name to another and for filtering using aliased fields. Mark aliased fields as deprecated. Rename the BOOTP dissector to DHCP and alias "bootp" to "dhcp". This lets you use both "dhcp.type" and "bootp.type" as display filter fields without having to duplicate all 500+ DHCP/BOOTP fields. To do: - Add checks to proto.c:check_valid_filter_name_or_fail? - Transition SSL to TLS. - Rename packet-bootp.c to packet-dhcp.c? Change-Id: I29977859995e8347d80b8e83f1618db441b10279 Ping-Bug: 14922 Reviewed-on: https://code.wireshark.org/review/29327 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>
2018-08-29epan: Remove unnecessary all protocols registration callbackJoão Valverde1-1/+1
We are exporting a registration function from libwireshark just to have it passed back as a callback. Seems unnecessary. Change-Id: I7621005c9be11691d319102326824c5e3520a6f3 Reviewed-on: https://code.wireshark.org/review/29328 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2018-05-05Don't use dladdr() to get a pathname for the current executable().Guy Harris1-1/+1
Change-Id: I24ad11a659c2cb936f873339dc2b36ac9944280a Reviewed-on: https://code.wireshark.org/review/27359 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-01Fix comment end after SPDX identifierStig Bjørlykke1-1/+2
Move */ to a separate line below the SPDX identifier. Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f Reviewed-on: https://code.wireshark.org/review/27211 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-24oss-fuzzshark: use install directory for headers. Install missing one.Jakub Zawadzki1-2/+1
From compilation log: epan/ipv4.h:19:10: fatal error: 'wsutil/inet_ipv4.h' file not found tools/oss-fuzzshark/fuzzshark.c:27:10: fatal error: 'version_info.h' file not found Change-Id: I3e147e014ae398ae07e64aec5a6535a8f9e357a3 Reviewed-on: https://code.wireshark.org/review/27076 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07spdx: more licenses converted.Dario Lombardo2-34/+2
Change-Id: I3861061ec261e63b23621799e020e811ed78a343 Reviewed-on: https://code.wireshark.org/review/26333 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07More licenses converted to SPDX.Dario Lombardo1-13/+1
Change-Id: Id4f987dcdacf06622d70263f4659a4400e30dc39 Reviewed-on: https://code.wireshark.org/review/26332 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-20fuzzshark: don't fuzz udplite.Jakub Zawadzki1-1/+2
Don't fuzz IP->udplite protocol. It's using most of UDP code, but cause udplite calls also udp dissectors it duplicates work of UDP fuzzer. This should also decrease IP corpus size, cause in IP corpus ~7.6% (9 165 out of 119 780) is udplite ip.proto Change-Id: I1d3bde6dd34f76696a34b1c728ce36f3c802e6c9 Link: https://github.com/google/oss-fuzz/issues/1087 Reviewed-on: https://code.wireshark.org/review/25950 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2018-02-15fuzzshark: disable reassembly for few protocolsYour Name1-4/+30
Reassembly (or in general being stateful) doesn't help when fuzzing, even if wireshark will crash oss-fuzz will try to reproduce the crash with just single sample. Single sample will not reproduce the crash, so being stateful makes wireshark 'buggy target'. I hope change will also make IP corpus a little bit smaller. Change-Id: I01ba8177a653d220c4cfe8a56a5836c96010c6fe Reviewed-on: https://code.wireshark.org/review/25799 Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2018-02-12fuzzshark: disable protocol in fuzzer if it's used by other fuzzer.Jakub Zawadzki2-7/+43
Change-Id: I4dcc38b2ac9711660c8cf27cbbabd879c2eee930 Link: https://github.com/google/oss-fuzz/issues/1087 Reviewed-on: https://code.wireshark.org/review/25738 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-09Generalize wtap_pkthdr into a structure for packet and non-packet records.Guy Harris1-9/+9
Separate the stuff that any record could have from the stuff that only particular record types have; put the latter into a union, and put all that into a wtap_rec structure. Add some record-type checks as necessary. Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2 Reviewed-on: https://code.wireshark.org/review/25696 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-08replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.Dario Lombardo1-1/+1
The first is deprecated, as per https://spdx.org/licenses/. Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed Reviewed-on: https://code.wireshark.org/review/25661 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-02fuzzshark: use SPDX identifier.Dario Lombardo1-14/+1
Change-Id: I9c786b8bbb96a4bfa1560536c3929b844aa8afb7 Reviewed-on: https://code.wireshark.org/review/25562 Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-01oss-fuzzshark: try to fix oss-fuzz assert fails.Jakub Zawadzki1-5/+10
Change-Id: Ic4ff70dfc55b2694f761cdadcac1962242fca753 Reviewed-on: https://code.wireshark.org/review/25551 Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2018-02-01oss-fuzzshark: test code to debug some oss-fuzz assert fails.Jakub Zawadzki1-0/+5
Change-Id: I5dbe899ca8a4f9107d62667ca107a4d3a48fe51b Reviewed-on: https://code.wireshark.org/review/25545 Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2018-01-09wiretap: add a parameter to wtap_init() indicating whether plugins must be ↵Pascal Quantin1-1/+1
loaded g995812c5f1 moved wiretap plugins registration from applications to wiretap library init function. As we do not want to load plugins for all users of libwiretap, let's make it configurable. Bug: 14314 Change-Id: Id8fdcc484e2d0d31d3ab0bd357d3a6678570f700 Reviewed-on: https://code.wireshark.org/review/25194 Reviewed-by: Dario Lombardo <lomato@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-21fuzzshark: fix no previous prototype for function ↵Alexis La Goutte3-3/+168
'LLVMFuzzerTestOneInput/LLVMFuzzerInitialize' [-Wmissing-prototypes] Change-Id: If5f425dda3cd793a63a69680c12aba12a20ed12e Reviewed-on: https://code.wireshark.org/review/24917 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-14Refactor plugin registration and loadingJoão Valverde1-14/+0
Put different types of plugins (libwiretap, libwireshark) in different subdirectories, give libwiretap and libwireshark init routines that load the plugins, and have them scan the appropriate subdirectories so that we don't even *try* to, for example, load libwireshark plugins in programs that only use libwiretap. Compiled plugins are stored in subfolders of the plugin folders, with the subfolder name being the Wireshark minor version number (X.Y). There is another hierarchical level for each Wireshark library (libwireshark, libwscodecs and libwiretap). The folder names are respectively plugins/X.Y/{epan,codecs,wiretap}. Currently we only distribute "epan" (libwireshark) plugins. Change-Id: I3438787a6f45820d64ba4ca91cbe3c8864708acb Reviewed-on: https://code.wireshark.org/review/23983 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-12-14Fix types.Guy Harris1-3/+3
ftell() returns a long; assign its value to a variable of that type. size_t is unsigned, so checking that it's >= 0 always succeeds. We can cast the variable's value to size_t once we've determined that it's non-negative; do so, to avoid other warnings. Change-Id: I0da6a220ce140ebf073df5f5bcd0c9526bf9c3c3 Reviewed-on: https://code.wireshark.org/review/24817 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-12fuzzer: add check for ftell return value (CID: 1426073).Dario Lombardo1-0/+1
Change-Id: I9b619c79433f267d87f6680eeb78a25daa169f4d Reviewed-on: https://code.wireshark.org/review/24778 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-08oss-fuzzshark: fix compilation.Jakub Zawadzki1-1/+1
/src/wireshark/tools/oss-fuzzshark/fuzzshark.c:268:58: error: too few arguments to function call, expected 2, have 1 fuzz_handle = get_dissector_handle(FUZZ_DISSECTOR_TARGET); ~~~~~~~~~~~~~~~~~~~~ ^ /src/wireshark/tools/oss-fuzzshark/fuzzshark.c:133:1: note: 'get_dissector_handle' declared here Change-Id: I6c6e25017f0045b833d9249c9648145893fe0439 Reviewed-on: https://code.wireshark.org/review/24742 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-12-08Hand the packet provider functions to epan_new().Guy Harris1-10/+9
Have separate packet_provider_data structures and packet_provider_funcs structures; the latter holds a table of functions that libwireshark can call for information about packets, the latter holds the data that those functions use. This means we no longer need to expose the structure of an epan_t outside epan/epan.c; get rid of epan/epan-int.h. Change-Id: I381b88993aa19e55720ce02c42ad33738e3f51f4 Reviewed-on: https://code.wireshark.org/review/24732 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-08Move the frame_set stuff back into the capture_file structure.Guy Harris1-2/+2
libwireshark now expects an epan_t to be created with a pointer to a "packet provider" structure; that structure is opaque within libwireshark, and a pointer to it is passed to the callbacks that provide interface names, interface, descriptions, user comments, and packet time stamps, and that set user comments. The code that calls epan_new() is expected to provide those callbacks, and to define the structure, which can be used by the providers. If none of the callbacks need that extra information, the "packet provider" structure can be null. Have a "file" packet provider for all the programs that provide packets from a file. Change-Id: I4b5709a3dd7b098ebd7d2a7d95bcdd7b5903c1a0 Reviewed-on: https://code.wireshark.org/review/24731 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-07Add fuzzshark to cmake/autotools.Jakub Zawadzki2-19/+177
Add fuzzshark target to make sure that oss-fuzzshark always build. Change-Id: I802b679c18023daa1475a54bae722b5e90c72a59 Reviewed-on: https://code.wireshark.org/review/24716 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-12-06oss-fuzzshark: fix handler of epan->get_frame_ts to fix build.Jakub Zawadzki1-1/+1
Fix oss-fuzzshark build after [1834dca3654ccec238bae130715871be3d8fa344]: Move the parts of a capture_file used by libwireshark to a new structure. I really need to integrate oss-fuzzshark with build system... Change-Id: I75595db392acfbdb7885975e458d8b434830cfec Reviewed-on: https://code.wireshark.org/review/24713 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-12-03Use cfile.h to define the capture_file type.Guy Harris1-1/+1
Have cfile-int.h declare the structure, and use it in files that directly access the structure. Have cfile.h just incompletely declare the structure and include it rather than explicitly declaring it in source files or other header files. Never directly refer to struct _capture_file except when typedeffing capture_file. Add #includes as necessary, now that cfile.h doesn't drag in a ton of Change-Id: I7931c8039d75ff7c980b0f2a6e221f20e602a556 Reviewed-on: https://code.wireshark.org/review/24686 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-01Get rid of some void pointers.Gerald Combs1-1/+1
Explictly struct _capture_file * in epan_session and its callbacks. Change-Id: I63703015c661a08f3350a7448a7bcdaf98f119dc Reviewed-on: https://code.wireshark.org/review/24675 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>
2017-11-21Move the protocol registration routines back into libwiresharkJoão Valverde1-5/+1
Follow-up to b695b3e2f72998d66ca4b7a6826d4ce1688060c8. Change-Id: I7e36519f2c3806c1205d05437671325080974257 Reviewed-on: https://code.wireshark.org/review/24524 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-11-21oss-fuzzshark: fix linking issues due to register_all_protocols() removed ↵Jakub Zawadzki1-1/+5
from -lepan During compilation of oss-fuzzshark (https://github.com/google/oss-fuzz/issues/1003): Step #3: /src/wireshark/tools/oss-fuzzshark/fuzzshark.c:213: undefined reference to `register_all_protocols' Step #3: /src/wireshark/tools/oss-fuzzshark/fuzzshark.c:213: undefined reference to `register_all_protocol_handoffs' After cleanup of make-dissector-reg.py [b695b3e2f72998d66ca4b7a6826d4ce1688060c8] these functions are no longer part of epan library (I really wonder why...). oss-fuzzshark need to compile and link register.c on their own. Change-Id: I79adf5c1513a0934f140bbf501c181bf14d7619b Reviewed-on: https://code.wireshark.org/review/24523 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-11-04oss-fuzzshark: force direct mallocMichael Mann1-0/+3
Set two environment variables (needs to be done before epan_init and before the first g_slice_alloc call) to force direct memory allocation without another layer that could hide bugs. Change-Id: I0d72092c239e2e7f42b0b7849c01471407e785e2 Reviewed-on: https://code.wireshark.org/review/21195 Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-26oss-fuzzshark: add missing include to fix implicit declaration of ↵Jakub Zawadzki1-0/+1
color_filters_init() /src/wireshark/tools/oss-fuzzshark/fuzzshark.c:218:7: warning: implicit declaration of function 'color_filters_init' is invalid in C99 [-Wimplicit-function-declaration] if (!color_filters_init(&err_msg, NULL)) ^ 1 warning generated. Change-Id: I37dbc4521b6a3cda271e6e33a290ed35911e7dda Reviewed-on: https://code.wireshark.org/review/24086 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-09-26Rename "ws_version_info.h", also .cJoão Valverde1-1/+1
It's not installed so like most other files it doesn't need or benefit from the prefix. Change-Id: I01517e06f12b3101fee21b68cba3bc6842bbef5c Reviewed-on: https://code.wireshark.org/review/23751 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-06-09Just print the string color_filters_init() provides on an error.Guy Harris1-1/+1
It gives all the necessary details; no need to mention the name of a routine the existence of which the user is probably unaware. Change-Id: I66d372bc6650c84fbbc6be438be695eff1048413 Reviewed-on: https://code.wireshark.org/review/22055 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-24fuzzshark: try to fix oss-build, remove oss-fuzzshark.c in old location.Jakub Zawadzki1-0/+2
Step #3: /src/wireshark/tools/oss-fuzzshark.c:190:2: warning: implicit declaration of function 'wtap_init' is invalid in C99 [-Wimplicit-function-declaration] (https://oss-fuzz-build-logs.storage.googleapis.com/log-472514ce-1a41-4f14-8798-d45084212a65.txt) Change-Id: I47715bdf55c20124a80da51d3c8812db1d8d94cf Reviewed-on: https://code.wireshark.org/review/21317 Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl> Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2017-04-24oss-fuzzshark: Copy to separate directory, add build script.Jakub Zawadzki2-0/+408
(oss-fuzz part https://github.com/google/oss-fuzz/pull/544) Change-Id: I54cf7a7b1aaa49582b5fff8bd034187aa6a9bdec Reviewed-on: https://code.wireshark.org/review/21302 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>