For the version Bhargava is testing I guess this reads as
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
  struct ofpbuf packet;
  ofpbuf_use_const(&packet, data, size);

  struct flow flow;

  flow_extract(&packet, NULL, &flow);

  return 0;
}

Looks great, and runs fast.


On Thu, Aug 31, 2017 at 2:05 PM, Bhargava Shastry <
[email protected]> wrote:

> Hi,
>
> > I didn't look at the actual code before, but now that I have, I don't
> > understand at all why it was doing file I/O just to write a packet to
> > disk and then read it back.
>
> Sorry, this was due to my ignorance. I was not aware of something like
> dp_packet_use_const(). This should speed things up. I am working on it.
>
> >
> > Here is a more natural way to do this:
> >
> > int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
> > {
> >     struct dp_packet packet;
> >     dp_packet_use_const(&packet, data, size);
> >
> >     struct flow flow;
> >     flow_extract(&packet, &flow);
> >
> >     return 0;
> > }
> >
>
> --
> Bhargava Shastry <[email protected]>
> Security in Telecommunications
> TU Berlin / Telekom Innovation Laboratories
> Ernst-Reuter-Platz 7, Sekr TEL 17 / D - 10587 Berlin, Germany
> phone: +49 30 8353 58235
> Keybase: https://keybase.io/bshastry
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to