From 497d589d56cf5e0ef758ca6c0443cdee7b3da91d Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 10 Apr 2007 12:01:33 +0000 Subject: gst/auparse/gstauparse.c: limit caps to the formats we announce in the template Original commit message from CVS: * gst/auparse/gstauparse.c: (gst_au_parse_parse_header): limit caps to the formats we announce in the template * gst/wavparse/gstwavparse.c: (uint64_ceiling_scale_int), (gst_wavparse_perform_seek), (gst_wavparse_stream_headers), (gst_wavparse_add_src_pad), (gst_wavparse_stream_data): fix some crashers/asserts when dealing with broken files --- gst/auparse/gstauparse.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'gst/auparse') diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c index 4664984c..d2658e40 100644 --- a/gst/auparse/gstauparse.c +++ b/gst/auparse/gstauparse.c @@ -21,7 +21,7 @@ /** * SECTION:element-auparse * @short_description: .au file parser - * + * * * * Parses .au files. @@ -269,6 +269,12 @@ gst_au_parse_parse_header (GstAuParse * auparse) auparse->samplerate = GST_READ_UINT32_BE (head + 16); auparse->channels = GST_READ_UINT32_BE (head + 20); + if (auparse->samplerate < 8000 || auparse->samplerate > 192000) + goto unsupported_sample_rate; + + if (auparse->channels < 1 || auparse->channels > 2) + goto unsupported_number_of_channels; + GST_DEBUG_OBJECT (auparse, "offset %" G_GINT64_FORMAT ", size %u, " "encoding %u, frequency %u, channels %u", auparse->offset, size, auparse->encoding, auparse->samplerate, auparse->channels); @@ -402,9 +408,22 @@ unknown_header: GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE, (NULL), (NULL)); return GST_FLOW_ERROR; } +unsupported_sample_rate: + { + GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), + ("Unsupported samplerate: %u", auparse->samplerate)); + return GST_FLOW_ERROR; + } +unsupported_number_of_channels: + { + GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), + ("Unsupported number of channels: %u", auparse->channels)); + return GST_FLOW_ERROR; + } unknown_format: { - GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), (NULL)); + GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), + ("Unsupported encoding: %u", auparse->encoding)); return GST_FLOW_ERROR; } add_pad_failed: -- cgit