Wireshark-commits: [Wireshark-commits] master 656cc19: Replace JSON-GLib by custom JSON dumper libr
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Tue, 20 Nov 2018 05:04:03 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=656cc19fc7de25c3ac7f9d847c37745ccc272247 Submitter: "Anders Broman <a.broman58@xxxxxxxxx>" Changed: branch: master Repository: wireshark Commits: 656cc19 by Peter Wu (peter@xxxxxxxxxxxxx): Replace JSON-GLib by custom JSON dumper library The (optional) JSON-GLib library adds dependencies on GObject, GIO. For statically linked oss-fuzz builds it also adds libffi and more. To avoid these dependencies, replace JSON-GLib by some custom code. This allows `tshark -G elastic-mapping` to be enabled by default without extra deps. API design goals of the new JSON dumper library: - Small interface without a lot of abstraction. - Avoid memory allocations if possible (currently none, but maybe json_puts_string will be replaced to improve UTF-8 support). - Do not implement parsing, this is currently handled by jsmn. Methods to open/close array/objects and to set members are inspired by the JsonGlib interface. The interfaces to write values is inspired by the sharkd code (json_puts_string is also borrowed from that). The only observed differences in the tshark output: - JSON-GLib ignores duplicates, json_dumper does not and may produce duplicates and currently print two "ip.opt.sec_prot_auth_unassigned". - JSON-GLib adds a space before a colon (unimportant formatting detail). - (Not observed, but UTF-8 strings will be wrong like bug 14948.) A test was added to catch changes in the tshark output. I also fuzzed json_dumper with libFuzzer + UBSAN/ASAN and fixed an off-by-one error. Change-Id: I0c85b18777b04d1e0f613a3d59935ec59be87ff4 Link: https://www.wireshark.org/lists/wireshark-dev/201811/msg00052.html Reviewed-on: https://code.wireshark.org/review/30732 Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx> Actions performed: from fb9c690 wsutil: rename some wsjson functions add 656cc19 Replace JSON-GLib by custom JSON dumper library Summary of changes: debian/libwsutil0.symbols | 8 + epan/proto.c | 140 ++++++------- epan/proto.h | 2 - test/baseline/elastic-mapping-ip-subset.json | 45 +++++ test/suite_clopts.py | 17 ++ tshark.c | 14 -- wsutil/CMakeLists.txt | 2 + wsutil/json_dumper.c | 285 +++++++++++++++++++++++++++ wsutil/json_dumper.h | 107 ++++++++++ 9 files changed, 525 insertions(+), 95 deletions(-) create mode 100644 test/baseline/elastic-mapping-ip-subset.json create mode 100644 wsutil/json_dumper.c create mode 100644 wsutil/json_dumper.h
- Prev by Date: [Wireshark-commits] master fb9c690: wsutil: rename some wsjson functions
- Next by Date: [Wireshark-commits] master 811d5f7: Drop JSON-GLib completely
- Previous by thread: [Wireshark-commits] master fb9c690: wsutil: rename some wsjson functions
- Next by thread: [Wireshark-commits] master 811d5f7: Drop JSON-GLib completely
- Index(es):
- Get Wireshark
- Download
- Code of Conduct