#16 segfault while calling dump_open

open-fixed
Wim Lewis
None
5
2012-01-05
2007-07-23
Wim Lewis
No

From a report on the help forum:

> segfault while calling dump_open
> Delete By: Shehjar Tikoo (shehjar) - 2007-07-10 19:24
> Hi
>
> Python2.4 crashes with a segfault while calling the dump_open method.
....
> I am using a P4 machine with Debian etch.

https://sourceforge.net/forum/message.php?msg_id=4406974

Discussion

  • kristjanbb
    kristjanbb
    2009-08-05

    dump_open can not be called before self->pcap has been initialized by calling some of the open_* functions.

    It's a lack of sanity check in both pylibpcap and libpcap. Just use open_offline(filename) instead.

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0xb7cc16c0 (LWP 16579)]
    pcap_dump_open (p=0x0, fname=0xb7c62bc4 "msndump.1") at ./savefile.c:1416
    1416 linktype = dlt_to_linktype(p->linktype);
    (gdb) up
    #1 0xb8038512 in pcapObject_dump_open (self=0x879d7f8, fname=0xb7d26bc4 "msndump.1") at pcap_interface.c:132
    132 self->pcap_dumper = pcap_dump_open(self->pcap, fname);
    (gdb) inspect self->pcap
    $1 = (pcap_t *) 0x0

     
  • Wim Lewis
    Wim Lewis
    2012-01-05

    Thanks for the extra investigation, kristjanbb. I've added more sanity checking to pylibpcap so you should get a nice Python exception now instead of a crash.

     
  • Wim Lewis
    Wim Lewis
    2012-01-05

    • status: open --> open-fixed