This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] Improve FuzzedDataProvider helper.
ClosedPublic

Authored by Dor1s on Jun 14 2019, 11:13 AM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

Dor1s created this revision.Jun 14 2019, 11:13 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 14 2019, 11:14 AM
Herald added subscribers: Restricted Project, jsji, delcypher. · View Herald Transcript
Dor1s updated this revision to Diff 204819.Jun 14 2019, 11:18 AM

Add static_assert guards to ConvertUnsignedToSigned.

jsji removed a subscriber: jsji.Jun 14 2019, 11:38 AM
Dor1s edited the summary of this revision. (Show Details)Jun 14 2019, 11:52 AM

The change is tested and ready for review. Please take a look :)

This revision is now accepted and ready to land.Jun 17 2019, 6:36 PM
Dor1s added a comment.Jun 18 2019, 8:38 AM

Thanks a lot, Matt!

Dor1s added a comment.Jun 18 2019, 1:18 PM

Hm, I'm doing the following:

$ arc commit --revision D63348
Committing 'D63348: [libFuzzer] Improve FuzzedDataProvider helper.'...
Done.

But the commit doesn't seem to happen.

Dor1s added a comment.Jun 18 2019, 1:19 PM

Trying rebase, re-running the tests, and committing again.

This revision was automatically updated to reflect the committed changes.