HomePhabricator

[libFuzzer] Improve FuzzedDataProvider helper.

Description

[libFuzzer] Improve FuzzedDataProvider helper.

Summary:
The following changes are made based on the feedback from Tim King:

  • Removed default template parameters, to have less assumptions.
  • Implemented ConsumeBytesWithTerminator method.
  • Made PickValueInArray method work with initializer_list argument.
  • Got rid of data_type type alias, that was redundant.
  • Refactored ConsumeBytes logic into a private method for better code reuse.
  • Replaced implementation defined unsigned to signed conversion.
  • Fixed ConsumeRandomLengthString to always call shrink_to_fit.
  • Clarified and fixed some commments.
  • Applied clang-format to both the library and the unittest source.

Tested on Linux, Mac, Windows.

Reviewers: morehouse, metzman

Reviewed By: morehouse

Subscribers: delcypher, #sanitizers, llvm-commits, kcc

Tags: #llvm, #sanitizers

Differential Revision: https://reviews.llvm.org/D63348

Details

Committed
Dor1sJun 18 2019, 1:29 PM
Reviewer
morehouse
Differential Revision
D63348: [libFuzzer] Improve FuzzedDataProvider helper.
Parents
rL363734: [OPENMP]Use host's mangling for 128 bit float types on the device.
Branches
Unknown
Tags
Unknown