srtpdec: Don't crash on invalid cipher
This commit is contained in:
parent
329c250a41
commit
4b89870a58
@ -96,6 +96,8 @@ enum_nick_from_value (GType enum_gtype, gint value)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
enum_value = g_enum_get_value (enum_class, value);
|
enum_value = g_enum_get_value (enum_class, value);
|
||||||
|
if (!enum_value)
|
||||||
|
return NULL;
|
||||||
nick = enum_value->value_nick;
|
nick = enum_value->value_nick;
|
||||||
g_type_class_unref (enum_class);
|
g_type_class_unref (enum_class);
|
||||||
|
|
||||||
@ -111,9 +113,11 @@ enum_value_from_nick (GType enum_gtype, const gchar * nick)
|
|||||||
gint value;
|
gint value;
|
||||||
|
|
||||||
if (!enum_gtype)
|
if (!enum_gtype)
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
enum_value = g_enum_get_value_by_nick (enum_class, nick);
|
enum_value = g_enum_get_value_by_nick (enum_class, nick);
|
||||||
|
if (!enum_value)
|
||||||
|
return -1;
|
||||||
value = enum_value->value;
|
value = enum_value->value;
|
||||||
g_type_class_unref (enum_class);
|
g_type_class_unref (enum_class);
|
||||||
|
|
||||||
|
@ -410,6 +410,13 @@ get_stream_from_caps (GstSrtpDec * filter, GstCaps * caps, guint32 ssrc)
|
|||||||
rtcp_cipher);
|
rtcp_cipher);
|
||||||
stream->rtcp_auth = enum_value_from_nick (GST_TYPE_SRTP_AUTH_TYPE, rtcp_auth);
|
stream->rtcp_auth = enum_value_from_nick (GST_TYPE_SRTP_AUTH_TYPE, rtcp_auth);
|
||||||
|
|
||||||
|
if (stream->rtp_cipher == -1 || stream->rtp_auth == -1 ||
|
||||||
|
stream->rtcp_cipher == -1 || stream->rtcp_auth == -1) {
|
||||||
|
GST_WARNING_OBJECT (filter, "Invalid caps for stream,"
|
||||||
|
" unknown cipher or auth type");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (stream->rtcp_cipher != NULL_CIPHER && stream->rtcp_auth == NULL_AUTH) {
|
if (stream->rtcp_cipher != NULL_CIPHER && stream->rtcp_auth == NULL_AUTH) {
|
||||||
GST_WARNING_OBJECT (filter,
|
GST_WARNING_OBJECT (filter,
|
||||||
"Cannot have SRTP NULL authentication with a not-NULL encryption"
|
"Cannot have SRTP NULL authentication with a not-NULL encryption"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user