[0.10] gst-plugins-ugly: amrwbdec: _parse should not return OK if not enough data yet

Tim Müller tpm at kemper.freedesktop.org
Wed Jan 18 04:25:00 PST 2012


Module: gst-plugins-ugly
Branch: 0.10
Commit: ca386bc1cf399d6dad0e326a1900a4d7f71b934a
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=ca386bc1cf399d6dad0e326a1900a4d7f71b934a

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Tue Jan 17 11:55:59 2012 +0100

amrwbdec: _parse should not return OK if not enough data yet

---

 ext/amrwbdec/amrwbdec.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ext/amrwbdec/amrwbdec.c b/ext/amrwbdec/amrwbdec.c
index e056a7a..5335866 100644
--- a/ext/amrwbdec/amrwbdec.c
+++ b/ext/amrwbdec/amrwbdec.c
@@ -183,7 +183,7 @@ gst_amrwbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter,
   gst_audio_decoder_get_parse_state (dec, &sync, &eos);
 
   /* need to peek data to get the size */
-  if (gst_adapter_available (adapter) < 1)
+  if (size < 1)
     return GST_FLOW_ERROR;
 
   data = gst_adapter_peek (adapter, 1);
@@ -193,6 +193,8 @@ gst_amrwbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter,
   GST_DEBUG_OBJECT (amrwbdec, "mode %d, block %d", mode, block);
 
   if (block) {
+    if (block > size)
+      return GST_FLOW_UNEXPECTED;
     *offset = 0;
     *length = block;
   } else {



More information about the gstreamer-commits mailing list