Giter VIP home page Giter VIP logo

Comments (6)

vitalybuka avatar vitalybuka commented on July 28, 2024

Not sure if I understand the question.
Still maybe PostProcessorRegistration can solve your problem?
You can use it to tweak message as you like.

static PostProcessorRegistration reg = {

from libprotobuf-mutator.

bshastry avatar bshastry commented on July 28, 2024

Thanks for your input. Yeah, I came to the same conclusion :-)

from libprotobuf-mutator.

bshastry avatar bshastry commented on July 28, 2024

Do you happen to know about this

libprotobuf-mutator/src/mutator.cc:471:43: runtime error: member call on address 0x000007da9f40 which  does not point to an object of type 'google::protobuf::Message'

from

const Descriptor* descriptor = message->GetDescriptor();

from libprotobuf-mutator.

vitalybuka avatar vitalybuka commented on July 28, 2024

can you share a reproducer?

from libprotobuf-mutator.

bshastry avatar bshastry commented on July 28, 2024

I think this may be an issue with my postprocessor callback implementation. I took a look at the linked example, where you add an optional field in a message

std::hash<std::string>{}(message->optional_string()));

Is there a slightly more advanced example where the field is itself a message that you need to create and add to the existing message passed via the callback?

Pseudo-code that I am using for this use-case is:

customMutation(
	Message::descriptor(),
	[](google::protobuf::Message* _message, unsigned int _seed)
	{
              if (_seed % 2) {
                    SubMessage* subMsg = new SubMessage();
                    // Add some custom values to subMsg
                    _message->set_allocated_SubMessage(subMsg);
              }
        }

from libprotobuf-mutator.

bshastry avatar bshastry commented on July 28, 2024

Closing because the original question has been addressed.

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.