[Bro-Dev] [JIRA] (BIT-1298) IP_Hdr pointer do not propagate from udp to child analyzers via DeliverPacket method causing a segfault

Jon Siwek (JIRA) jira at bro-tracker.atlassian.net
Fri Dec 12 11:13:00 PST 2014

    [ https://bro-tracker.atlassian.net/browse/BIT-1298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19214#comment-19214 ] 

Jon Siwek commented on BIT-1298:

I would be more comfortable if the copy operation were a method one has to call explicitly, rather a copy constructor that's easy to have run implicitly. What do you think?

Yeah, I think should be ok.

Nit: You lost me on the swap() operation: why's the copy constructor doing a swap on the fields rather than just an assignment?

I was going for the "copy-and-swap" idiom (or I think also called "unified assignment" for C++11 since it takes the place of both copy and move ctor) --
the copy assignment operator takes a parameter by value which implies the copy ctor in this case and then swaps the current object with that copy and so completing the assignment, then the temporary goes out of scope and cleans up whatever existed before the assignment.  At least that was the intention, maybe there was something more specific you're trying to point out that I'm not seeing wrong with it (but I guess this all goes away doing the explicit copy method).

> IP_Hdr pointer do not propagate from udp to child analyzers via DeliverPacket method causing a segfault
> -------------------------------------------------------------------------------------------------------
>                 Key: BIT-1298
>                 URL: https://bro-tracker.atlassian.net/browse/BIT-1298
>             Project: Bro Issue Tracker
>          Issue Type: Problem
>          Components: Bro
>    Affects Versions: 2.3
>         Environment: Debian
>            Reporter: Eric Asselin
>            Assignee: Jon Siwek
>            Priority: High
>              Labels: analyzer
>         Attachments: core.zip, ntp-synchronized.pcap
> From a child analyzer like NTP, the IP_Hdr pointer in the DeliverPacket method is empty and unusable causing a segmentation fault as soon as you try to access it.
> To recreate the bug, just add an "assert(ip)" inside the DeliverPacket method of a UDP child analyzer and the execution will fail (instead of the segmentation fault).

This message was sent by Atlassian JIRA

More information about the bro-dev mailing list