Giter VIP home page Giter VIP logo

Comments (5)

kcc avatar kcc commented on July 28, 2024

I agree we should do something like this, but not sure how.
Your 3 variants all look sane, the first one is better, if we can implement it.
Before coming up with a 'final' interface I'd like to have 2-3 examples in this repo using the existing (verbose) interface.

One question: what headers are we going to require?
Obviously, we will need #include "myproto.pb.h", but what else?
I don't want to require any headers from libFuzzer.
And if possible not even from libprotobuf-mutator

use data+size as input
did you mean use proto as input?

from libprotobuf-mutator.

mikea avatar mikea commented on July 28, 2024

I don't know if not including mutator header is feasible. We discussed this at length and we didn't find a way to discover function with unknown signature.

But this brings a related question to my mind: maybe we want mutator library to be header-only?

PS fixed code samples comments

from libprotobuf-mutator.

kcc avatar kcc commented on July 28, 2024

maybe we want mutator library to be header-only?

That's possible and might be a part of solution.
But then again, what if we want to use some other proto mutation tool?

I don't know if not including mutator header is feasible.

Well, at the very least we can use the -i compiler flag to include something under the hood for cases were we control the build system.

Anyway, let's not rush here. With more proto fuzz targets a better understanding may come.

from libprotobuf-mutator.

vitalybuka avatar vitalybuka commented on July 28, 2024

We should not use header only, as it will force us to compile and instrument mutator together with fuzz target.

If we want to avoid headers at all, we can go with:

extern "C" google::protobuf::Message* LLVMFuzzerGetDefaultProto() {
  return MyProto::default_instance();
}
extern "C" int LLVMFuzzerTestProto(google::protobuf::Message& message) {
  const MyProto& my_message = static_cast<const MyProto&>(message);
  ....
  return 0;
}

So user will have to cast.

If we allow some small header, I'd go with

void SomeTestCode(const MyProto& message) {
}
protobuf_mutator::libfuzzer::TextFuzzer<MyProto> fuzzer(&SomeTestCode); // or just lambda

Which can be reduced to macro, like in the first comment:

LLVM_FUZZER_PROTO(const MyProto& proto) {
}

from libprotobuf-mutator.

vitalybuka avatar vitalybuka commented on July 28, 2024

Fixed with #63

from libprotobuf-mutator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.