gst-plugins-ugly: amrnbdec: _parse should not return OK if not enough data yet

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Tue Jan 17 03:00:15 PST 2012


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

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

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

---

 ext/amrnb/amrnbdec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ext/amrnb/amrnbdec.c b/ext/amrnb/amrnbdec.c
index 5f6c64b..bf59d8d 100644
--- a/ext/amrnb/amrnbdec.c
+++ b/ext/amrnb/amrnbdec.c
@@ -257,7 +257,7 @@ gst_amrnbdec_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);
@@ -280,6 +280,9 @@ gst_amrnbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter,
 
   GST_DEBUG_OBJECT (amrnbdec, "mode %d, block %d", mode, block);
 
+  if (block > size)
+    return GST_FLOW_UNEXPECTED;
+
   *offset = 0;
   *length = block;
 



More information about the gstreamer-commits mailing list