After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 743414 - rtpvp8: undefined behaviour. division by zero
rtpvp8: undefined behaviour. division by zero
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-01-23 16:50 UTC by Luis de Bethencourt
Modified: 2015-01-26 10:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.05 KB, patch)
2015-01-23 16:50 UTC, Luis de Bethencourt
reviewed Details | Review

Description Luis de Bethencourt 2015-01-23 16:50:40 UTC
Created attachment 295288 [details] [review]
proposed patch

gst_rtp_buffer_calc_payload_len () can return zero if packet length is smaller than header length. It is unlikely but this function checks for this and returns 0, then if it does, max_paylen will become zero and will be the divisor in the next line.

  list = gst_buffer_list_new_sized ((size / max_paylen) + 1);

Which would make _handle_buffer() of rtpvp8 have undefined behaviour.
Comment 1 Luis de Bethencourt 2015-01-23 17:58:49 UTC
Not completely sure about the solution. Posting it here for review/discussion.

If anybody likes it, please mark it as accepted.
Comment 2 Tim-Philipp Müller 2015-01-25 13:02:19 UTC
I don't think this can happen or make sense to add "just in case".

Minimum mtu is 28 (coverity probably doesn't know that), and usually more like ~1400.

Max vp8_hdr_len is 4, so smallest packet_len passed to gst_rtp_buffer_calc_payload_len() is 24. csrc_count and pad_len are always 0 here, and GST_RTP_HEADER_LEN is 12.

(>=24) < 12 -> always false.
Comment 3 Luis de Bethencourt 2015-01-25 19:15:21 UTC
I understand. I can mark the coverity issue as a false positive.

Does this mean the following check in gst_rtp_buffer_calc_payload_len() is never going to be True?:

  if (packet_len <
      GST_RTP_HEADER_LEN + (csrc_count * sizeof (guint32)) + pad_len)
    return 0;

gst-plugins-base/gst-libs/gst/rtp/gstrtpbuffer.c:292

Should it be removed or does it serve a purpose?
Comment 4 Tim-Philipp Müller 2015-01-26 08:52:40 UTC
It does serve a purpose in general, just not in this particular case. I don't think it should be removed.
Comment 5 Luis de Bethencourt 2015-01-26 10:22:22 UTC
I will close this bug then. Thanks for looking into it.