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
This commit is contained in:
Sebastian Dröge 2016-09-14 11:20:48 +02:00
parent 77f4d2f06b
commit 8443af343e
3 changed files with 11 additions and 11 deletions

View file

@ -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)))

View file

@ -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;
@ -2166,7 +2166,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:

View file

@ -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)))