[PATCH] D27234: [libFuzzer] Diff 4 - Split FuzzerUtil implementation for Posix and Windows.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 14:58:46 PST 2016


zturner added inline comments.


================
Comment at: lib/Fuzzer/FuzzerUtil.cpp:217
   size_t N;
-  while ((N = fread(Buff, 1, sizeof(Buff), Pipe)) > 0)
+  while ((N = fread(Buff, 1, sizeof(Buff), Pipe)) == sizeof(Buff))
     Out->append(Buff, N);
----------------
kcc wrote:
> why this change from >0 to == sizeof(Buff)
> 
> In general, please avoid mixing refactoring and functionality changes. 
That change was my suggestion.  The code is incorrect as written because `fread` doesn't use <= 0 to indicate an error, it uses != request_size, then you check `ferror`.  In any case, your point about mixing functionality and refactoring changes is still valid, so it might be worth doing this in a followup as you suggest.


Repository:
  rL LLVM

https://reviews.llvm.org/D27234





More information about the llvm-commits mailing list