From db8460cbd8e6c64a7683af754929966ca2091f98 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 2 May 2014 15:09:35 +0100 Subject: rtpbuffer: avoid underflow in size calculation --- gst-libs/gst/rtp/gstrtpbuffer.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gst-libs/gst/rtp') diff --git a/gst-libs/gst/rtp/gstrtpbuffer.c b/gst-libs/gst/rtp/gstrtpbuffer.c index f3fd4f4b8..6ff9256ab 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.c +++ b/gst-libs/gst/rtp/gstrtpbuffer.c @@ -294,6 +294,10 @@ gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len, { g_return_val_if_fail (csrc_count <= 15, 0); + if (packet_len < + GST_RTP_HEADER_LEN + (csrc_count * sizeof (guint32)) + pad_len) + return 0; + return packet_len - GST_RTP_HEADER_LEN - (csrc_count * sizeof (guint32)) - pad_len; } -- cgit v1.2.3