1 From 722b15abcaadbf32542184df889ed06d7a01f8fe Mon Sep 17 00:00:00 2001
2 From: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
3 Date: Sun, 27 May 2012 23:41:24 +0100
4 Subject: [PATCH 16/20] opusdec: do not assert on bad header, error out
8 ext/opus/gstopusdec.c | 11 ++++++++---
9 1 file changed, 8 insertions(+), 3 deletions(-)
11 diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c
12 index cbfc3ac..9fb397c 100644
13 --- a/ext/opus/gstopusdec.c
14 +++ b/ext/opus/gstopusdec.c
15 @@ -240,9 +240,14 @@ gst_opus_dec_parse_header (GstOpusDec * dec, GstBuffer * buf)
17 const GstAudioChannelPosition *pos = NULL;
19 - g_return_val_if_fail (gst_opus_header_is_id_header (buf), GST_FLOW_ERROR);
20 - g_return_val_if_fail (dec->n_channels == 0
21 - || dec->n_channels == data[9], GST_FLOW_ERROR);
22 + if (!gst_opus_header_is_id_header (buf)) {
23 + GST_ERROR_OBJECT (dec, "Header is not an Opus ID header");
24 + return GST_FLOW_ERROR;
26 + if (!(dec->n_channels == 0 || dec->n_channels == data[9])) {
27 + GST_ERROR_OBJECT (dec, "Opus ID header has invalid channels");
28 + return GST_FLOW_ERROR;
31 dec->n_channels = data[9];
32 dec->pre_skip = GST_READ_UINT16_LE (data + 10);