summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-09-14 11:20:48 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-09-14 11:20:48 +0200
commit8443af343ec7dc026e27ab9cbf5d2ec47bd6fc4d (patch)
tree3737fd178129e0e4d6cfca95636b66834b227f74
parent77f4d2f06bddf74ade93c2705493793b2bb5c0d6 (diff)
downloadgst-libav-8443af343ec7dc026e27ab9cbf5d2ec47bd6fc4d.tar.gz
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
-rw-r--r--ext/libav/gstavaudenc.c2
-rw-r--r--ext/libav/gstavcodecmap.c18
-rw-r--r--ext/libav/gstavvidenc.c2
3 files changed, 11 insertions, 11 deletions
diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c
index 3f39ce1..5b34a59 100644
--- a/ext/libav/gstavaudenc.c
+++ b/ext/libav/gstavaudenc.c
@@ -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)))
diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c
index a507c5a..2274989 100644
--- a/ext/libav/gstavcodecmap.c
+++ b/ext/libav/gstavcodecmap.c
@@ -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:
diff --git a/ext/libav/gstavvidenc.c b/ext/libav/gstavvidenc.c
index 2ec32d8..6def859 100644
--- a/ext/libav/gstavvidenc.c
+++ b/ext/libav/gstavvidenc.c
@@ -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)))