summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-01-15 18:31:56 +0100
committerSebastian Dröge <sebastian@centricular.com>2017-01-16 19:23:37 +0200
commit5051ae9a5acdd9354c4583be449889528f055cf2 (patch)
tree60d7f31f5373f46be8783cdce6efa79434bf2025
parent2faf47c71de80d13e53946ea7a1ac7367c4733e3 (diff)
downloadgstreamer-plugins-base-5051ae9a5acdd9354c4583be449889528f055cf2.tar.gz
riff-media: Check for valid channels/rate before using the values
Otherwise we might divide by zero or otherwise create invalid caps. https://bugzilla.gnome.org/show_bug.cgi?id=777262
-rw-r--r--gst-libs/gst/riff/riff-media.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
index a103a389c..87b82f9dd 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -1609,7 +1609,8 @@ gst_riff_create_audio_caps (guint16 codec_id,
subformat_guid[2] == 0xaa000080 && subformat_guid[3] == 0x719b3800) {
if (subformat_guid[0] == 0x00000001) {
GST_DEBUG ("PCM");
- if (strf != NULL) {
+ if (strf != NULL && strf->blockalign != 0 && strf->channels != 0
+ && strf->rate != 0) {
gint ba = strf->blockalign;
gint wd = ba * 8 / strf->channels;
gint ws;
@@ -1642,7 +1643,8 @@ gst_riff_create_audio_caps (guint16 codec_id,
}
} else if (subformat_guid[0] == 0x00000003) {
GST_DEBUG ("FLOAT");
- if (strf != NULL) {
+ if (strf != NULL && strf->blockalign != 0 && strf->channels != 0
+ && strf->rate != 0) {
gint ba = strf->blockalign;
gint wd = ba * 8 / strf->channels;