rtcpbuffer: fix function guards with side effects

Code in g_return_*() must not have side effects, as it
might be compiled out if -DG_DISABLE_CHECKS is used, in
which case we would read garbage off the stack.
This commit is contained in:
Tim-Philipp Müller 2018-12-30 17:26:04 +00:00
parent 56688ce078
commit 44b18ea2b6

View file

@ -2822,8 +2822,9 @@ gst_rtcp_packet_xr_get_rle_nth_chunk (GstRTCPPacket * packet,
guint32 chunk_count;
guint8 *data;
g_return_val_if_fail (gst_rtcp_packet_xr_get_rle_info (packet, NULL, NULL,
NULL, NULL, &chunk_count), FALSE);
if (!gst_rtcp_packet_xr_get_rle_info (packet, NULL, NULL, NULL, NULL,
&chunk_count))
g_return_val_if_reached (FALSE);
if (nth >= chunk_count)
return FALSE;
@ -2917,8 +2918,9 @@ gst_rtcp_packet_xr_get_prt_by_seq (GstRTCPPacket * packet,
guint16 begin_seq, end_seq;
guint8 *data;
g_return_val_if_fail (gst_rtcp_packet_xr_get_prt_info (packet, NULL, NULL,
&begin_seq, &end_seq), FALSE);
if (!gst_rtcp_packet_xr_get_prt_info (packet, NULL, NULL, &begin_seq,
&end_seq))
g_return_val_if_reached (FALSE);
if (seq >= end_seq || seq < begin_seq)
return FALSE;