
On Tue, Aug 27, 2024 at 02:15:10PM +0300, Rayhan Faizel wrote:
On Tue, Aug 27, 2024 at 1:51 PM Martin Kletzander <mkletzan@redhat.com> wrote:
On Tue, Aug 27, 2024 at 12:08:27PM +0300, Rayhan Faizel wrote:
All the existing code is indeed still compiled as C. Only the fuzzing executables (under tests/fuzz/) are compiled in C++ and linked to those C objects. We still do need some of the minor code modifications (in PATCH 1) because existing C headers are sometimes interpreted a bit differently from the fuzzer's PoV, even with C linkage.
Sorry, what I meant is whether it would be possible to keep the code as is, the keyword parameters are a bit of a problem, but writing a layer of C code to call it through from the C++ code feels weird. Of course attributes are also complicated to make work, but those changes in the C code are pretty okay I think.
Sorry, I am not sure I fully understand the first statement regarding writing a layer of C code. I had only replaced the keyword parameters with alternative names in PATCH 1.
My bad, I was trying to be brief and overdone it. What I meant is a function that would look like the following, but it would not be a very nice solution: int callableFromCPlusPlus(int a, int b) { return orig(a, b); } and call that one from C++. Now that I think about it, it could be even easier, and maybe more awkward, if you only changed the declarations in the header. But anyway, we're getting sidetracked, sorry for that.
There are still some other code modifications in tests/ and src/ for a few other fuzzers (mostly hotplug and CH) to make fuzzing easier.
I agree that we could keep it as a separate repo, perhaps a subproject. I have seen some projects keep their fuzzing code separate (mostly on oss-fuzz).
-- Rayhan Faizel
-- Rayhan Faizel