summaryrefslogtreecommitdiff
path: root/ext/opus/gstopusdec.c
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2012-05-27 23:41:24 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2012-05-27 23:45:53 +0100
commit0c55e0d98beac5af52e1bcb09bbd6d00f67d9067 (patch)
tree1536d759cc62000e3da9ae3cf1f1f2ad6d3583d1 /ext/opus/gstopusdec.c
parentf4848be30eeeeeee875146a1442a7d3724ec169a (diff)
downloadgstreamer-plugins-bad-0c55e0d98beac5af52e1bcb09bbd6d00f67d9067.tar.gz
opusdec: do not assert on bad header, error out instead
Diffstat (limited to 'ext/opus/gstopusdec.c')
-rw-r--r--ext/opus/gstopusdec.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c
index 626e785af..15bec7b42 100644
--- a/ext/opus/gstopusdec.c
+++ b/ext/opus/gstopusdec.c
@@ -261,13 +261,19 @@ gst_opus_dec_parse_header (GstOpusDec * dec, GstBuffer * buf)
const GstAudioChannelPosition *posn = NULL;
GstMapInfo map;
- g_return_val_if_fail (gst_opus_header_is_id_header (buf), GST_FLOW_ERROR);
+ if (!gst_opus_header_is_id_header (buf)) {
+ GST_ERROR_OBJECT (dec, "Header is not an Opus ID header");
+ return GST_FLOW_ERROR;
+ }
gst_buffer_map (buf, &map, GST_MAP_READ);
data = map.data;
- g_return_val_if_fail (dec->n_channels == 0
- || dec->n_channels == data[9], GST_FLOW_ERROR);
+ if (!(dec->n_channels == 0 || dec->n_channels == data[9])) {
+ gst_buffer_unmap (buf, &map);
+ GST_ERROR_OBJECT (dec, "Opus ID header has invalid channels");
+ return GST_FLOW_ERROR;
+ }
dec->n_channels = data[9];
dec->pre_skip = GST_READ_UINT16_LE (data + 10);