[PATCH] D74359: [compiler-rt] FuzzedDataProvider: add ConsumeData method.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 13:55:26 PST 2020


Dor1s marked an inline comment as done.
Dor1s added inline comments.


================
Comment at: compiler-rt/include/fuzzer/FuzzedDataProvider.h:246
+  // fuzzing data.
+  size_t ConsumeData(void *destination, size_t num_bytes) {
+    num_bytes = std::min(num_bytes, remaining_bytes_);
----------------
metzman wrote:
> Might be better not to use the same name "Consume" as other methods since this method is used a bit differently than other methods which return their value.
Hmm... I agree it's different, but what would be a good alternative? `Copy` or `Write` are also not very intuitive as the internal pointer gets advanced and the data is in fact being consumed.

Also feels like we could just get rid of the `Consume` prefix for all the methods, but it's too late now :D 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74359/new/

https://reviews.llvm.org/D74359





More information about the llvm-commits mailing list