From 5a77d263142b2bce92f5a45a5d7db730ed1200a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 23 Dec 2015 20:24:46 +0000 Subject: pcapparse: don't crash on 0-sized packets https://bugzilla.gnome.org/show_bug.cgi?id=756573 --- gst/pcapparse/gstpcapparse.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gst/pcapparse/gstpcapparse.c b/gst/pcapparse/gstpcapparse.c index d7f8efdf8..9e20d8623 100644 --- a/gst/pcapparse/gstpcapparse.c +++ b/gst/pcapparse/gstpcapparse.c @@ -490,7 +490,11 @@ gst_pcap_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) * buffer with a single memory, since the RTP depayloaders expect * the complete RTP header to be in the first memory if there are * multiple ones and we can't guarantee that with _fast() */ - out_buf = gst_adapter_take_buffer (self->adapter, payload_size); + if (payload_size > 0) { + out_buf = gst_adapter_take_buffer (self->adapter, payload_size); + } else { + out_buf = gst_buffer_new (); + } gst_adapter_flush (self->adapter, self->cur_packet_size - offset - payload_size); -- cgit v1.2.1