Commit 7acff261 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

av: Cast AVContext::bit_rate to a guint before passing to varargs functions

We expect it to be a int or uint, however it changed the type to a
int64_t in later versions of ffmpeg. As such it would be passed as a 64
bit value to varargs functions, while the consumer of the arguments
assumes only 32 bits. This causes crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=771092
parent ae6b12a3
......@@ -394,7 +394,7 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
const gchar *codec;
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_NOMINAL_BITRATE,
ffmpegaudenc->context->bit_rate, NULL);
(guint) ffmpegaudenc->context->bit_rate, NULL);
if ((codec =
gst_ffmpeg_get_codecid_longname (ffmpegaudenc->context->codec_id)))
......
......@@ -1146,8 +1146,8 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
caps =
gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
"wmaversion", G_TYPE_INT, version, "block_align", G_TYPE_INT,
context->block_align, "bitrate", G_TYPE_INT, context->bit_rate,
NULL);
context->block_align, "bitrate", G_TYPE_INT,
(guint) context->bit_rate, NULL);
} else {
caps =
gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
......@@ -1824,7 +1824,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
"bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
break;
case AV_CODEC_ID_ADPCM_G726:
......@@ -1836,7 +1836,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
"bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
if (!encode) {
gst_caps_append (caps, gst_caps_new_simple ("audio/x-adpcm",
......@@ -1970,7 +1970,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
"bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
break;
......@@ -2012,7 +2012,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
if (context) {
gst_caps_set_simple (caps,
"leaf_size", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
"bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
}
break;
......@@ -2044,7 +2044,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
if (context) {
gst_caps_set_simple (caps,
"leaf_size", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
"bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
}
break;
......@@ -2082,7 +2082,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
"bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
break;
......@@ -2161,7 +2161,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id,
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
"bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
g_free (mime);
break;
default:
......
......@@ -487,7 +487,7 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
const gchar *codec;
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_NOMINAL_BITRATE,
ffmpegenc->context->bit_rate, NULL);
(guint) ffmpegenc->context->bit_rate, NULL);
if ((codec =
gst_ffmpeg_get_codecid_longname (ffmpegenc->context->codec_id)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment