Commit Graph

4 Commits

Author SHA1 Message Date
Ewout van Bekkum
f89f1379d4 pw_string: redo pw::string::Length
Moves and renames the existing pw::string::Length to
pw::string::internal::ClampedLength. Instead two new helpers are added:
1) pw::string::NullTerminatedLength(...) which returns the length IFF
   the string is null terminated.
2) pw::string::ClampedCString(...) which returns a string_view of
   the clamped string. This is considered safer compared to strnlen_s
   and the existing internal::ClampedLength implementation, since
   sting_view does not require null termination.

Change-Id: Ie6486df13b205332633f3970109ca97f578e6993
Requires: pigweed-internal:12460
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/43463
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
2021-05-13 16:27:34 +00:00
Ali Zhang
5876558bba pw_fuzzer: Add dedicated toolchain and target for fuzzing
Adds a "//targets/host:host_clang_fuzz" target so fuzzers get built
along with other build targets. This new target uses "address" as the
default sanitizer for fuzzing. Sanitizers are overridable via
pw_toolchain_SANITIZERS.

Adds a top-level "fuzzers" target so it could be used (e.g. by
OSS-Fuzz) to just fuzzers.

Test: build normally and run
      `//out/host_clang_fuzz/obj/pw_fuzzer/bin/toy_fuzzer`

Change-Id: I4f1df389289ae7a47b29738a3c245f7bac308a08
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/31301
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Pigweed-Auto-Submit: Ali Zhang <alizhang@google.com>
2021-02-02 22:55:17 +00:00
Keir Mierle
6a106368c2 pw_fuzzer: Restore fuzzer
The fuzzer hasn't worked for a bit due to the build refactor. This is a
CL to bring it back. Some design discussion may be needed around how
the toolchains are selected.

Change-Id: I2e81a69a4badeed6fff59a57bc757f06d13dfed9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/29580
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ali Zhang <alizhang@google.com>
2021-01-23 00:44:39 +00:00
Aaron Green
f3c3d2b935 pw_fuzzer: Add module
This CL adds fuzzing support, in the form of GN logic, docs, and an
example fuzzer.

You can run this fuzzer with the following:
$ pw_fuzzer/examples/build_and_run_toy_fuzzer.sh

This is rather bare-bones at the moment. Additional features, like
corpus and dictionary integration, more sanitizers, etc. are follow-on
work.

Change-Id: I7fb4d5ecbb59d1e9b69f4594db4222728b8da2f9
2020-04-06 18:22:00 +00:00