From: Wim Taymans Date: Fri, 16 Mar 2012 20:47:21 +0000 (+0100) Subject: don't pass random pointers to pull_range X-Git-Tag: 1.19.3~509^2~7218 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=513d480fbff380e9ce279242ededd7d1f19ed7af;p=platform%2Fupstream%2Fgstreamer.git don't pass random pointers to pull_range --- diff --git a/ext/libpng/gstpngdec.c b/ext/libpng/gstpngdec.c index aae356f..0c10b4c 100644 --- a/ext/libpng/gstpngdec.c +++ b/ext/libpng/gstpngdec.c @@ -282,7 +282,7 @@ static void user_read_data (png_structp png_ptr, png_bytep data, png_size_t length) { GstPngDec *pngdec; - GstBuffer *buffer; + GstBuffer *buffer = NULL; GstFlowReturn ret = GST_FLOW_OK; guint size; diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 6e19e61..8b27cde 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -2658,7 +2658,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi) { GstFlowReturn res; guint64 offset = avi->offset; - GstBuffer *buf; + GstBuffer *buf = NULL; guint32 tag; guint32 size; GstMapInfo map; @@ -2685,6 +2685,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi) gst_buffer_unmap (buf, &map); gst_buffer_unref (buf); + buf = NULL; res = gst_pad_pull_range (avi->sinkpad, offset, 8, &buf); if (res != GST_FLOW_OK) goto pull_failed; @@ -3719,6 +3720,7 @@ gst_avi_demux_stream_header_pull (GstAviDemux * avi) guint size; guint32 tag, ltag; + buf = NULL; res = gst_pad_pull_range (avi->sinkpad, avi->offset, 12, &buf); if (res != GST_FLOW_OK) { GST_DEBUG_OBJECT (avi, "pull_range failure while looking for tags"); @@ -3800,6 +3802,7 @@ gst_avi_demux_stream_header_pull (GstAviDemux * avi) case GST_MAKE_FOURCC ('J', 'U', 'N', 'K'): /* Only get buffer for debugging if the memdump is needed */ if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >= 9) { + buf = NULL; res = gst_pad_pull_range (avi->sinkpad, avi->offset, size, &buf); if (res != GST_FLOW_OK) { GST_DEBUG_OBJECT (avi, "couldn't read INFO chunk"); @@ -4708,6 +4711,7 @@ gst_avi_demux_loop_data (GstAviDemux * avi) /* FIXME, check large chunks and cut them up */ /* pull in the data */ + buf = NULL; ret = gst_pad_pull_range (avi->sinkpad, offset, size, &buf); if (ret != GST_FLOW_OK) goto pull_failed; diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c index 4c108a6..ae8e520 100644 --- a/gst/flv/gstflvdemux.c +++ b/gst/flv/gstflvdemux.c @@ -2080,6 +2080,7 @@ gst_flv_demux_pull_tag (GstPad * pad, GstFlvDemux * demux) demux->offset += FLV_TAG_TYPE_SIZE; /* Pull the whole tag */ + buffer = NULL; if (G_UNLIKELY ((ret = gst_flv_demux_pull_range (demux, pad, demux->offset, demux->tag_size, &buffer)) != GST_FLOW_OK)) goto beach; @@ -2241,12 +2242,14 @@ gst_flv_demux_create_index (GstFlvDemux * demux, gint64 pos, GstClockTime ts) old_offset = demux->offset; demux->offset = pos; + buffer = NULL; while ((ret = gst_flv_demux_pull_range (demux, demux->sinkpad, demux->offset, 12, &buffer)) == GST_FLOW_OK) { tag_time = gst_flv_demux_parse_tag_timestamp (demux, TRUE, buffer, &tag_size); gst_buffer_unref (buffer); + buffer = NULL; if (G_UNLIKELY (tag_time == GST_CLOCK_TIME_NONE || tag_time > ts)) goto exit; diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index bfb32e7..10eb772 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -2682,7 +2682,7 @@ gst_qtdemux_loop_state_header (GstQTDemux * qtdemux) } case FOURCC_moov: { - GstBuffer *moov; + GstBuffer *moov = NULL; if (qtdemux->got_moov) { GST_DEBUG_OBJECT (qtdemux, "Skipping moov atom as we have one already"); @@ -2745,7 +2745,7 @@ gst_qtdemux_loop_state_header (GstQTDemux * qtdemux) } case FOURCC_ftyp: { - GstBuffer *ftyp; + GstBuffer *ftyp = NULL; /* extract major brand; might come in handy for ISO vs QT issues */ ret = gst_qtdemux_pull_atom (qtdemux, cur_offset, length, &ftyp); @@ -2760,7 +2760,7 @@ gst_qtdemux_loop_state_header (GstQTDemux * qtdemux) } case FOURCC_uuid: { - GstBuffer *uuid; + GstBuffer *uuid = NULL; /* uuid are extension atoms */ ret = gst_qtdemux_pull_atom (qtdemux, cur_offset, length, &uuid); @@ -2775,7 +2775,7 @@ gst_qtdemux_loop_state_header (GstQTDemux * qtdemux) } default: { - GstBuffer *unknown; + GstBuffer *unknown = NULL; GST_LOG_OBJECT (qtdemux, "unknown %08x '%" GST_FOURCC_FORMAT "' of size %" G_GUINT64_FORMAT @@ -5179,6 +5179,7 @@ qtdemux_find_atom (GstQTDemux * qtdemux, guint64 * offset, while (TRUE) { GstMapInfo map; + buf = NULL; ret = gst_pad_pull_range (qtdemux->sinkpad, *offset, 16, &buf); if (G_UNLIKELY (ret != GST_FLOW_OK)) goto locate_failed; diff --git a/gst/matroska/matroska-parse.c b/gst/matroska/matroska-parse.c index 4c9a662..9a2d724 100644 --- a/gst/matroska/matroska-parse.c +++ b/gst/matroska/matroska-parse.c @@ -1229,7 +1229,7 @@ gst_matroska_parse_search_cluster (GstMatroskaParse * parse, gint64 * pos) gint64 orig_offset; GstFlowReturn ret = GST_FLOW_OK; const guint chunk = 64 * 1024; - GstBuffer *buf = NULL; + GstBuffer *buf; GstMapInfo map; gpointer data; gsize size; @@ -1244,6 +1244,7 @@ gst_matroska_parse_search_cluster (GstMatroskaParse * parse, gint64 * pos) GstByteReader reader; gint cluster_pos; + buf = NULL; ret = gst_pad_pull_range (parse->common.sinkpad, newpos, chunk, &buf); if (ret != GST_FLOW_OK) break; diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index 3930dab..2bd0e6c 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -1285,6 +1285,7 @@ gst_wavparse_stream_headers (GstWavParse * wav) } else { GstMapInfo map; + buf = NULL; if ((res = gst_pad_pull_range (wav->sinkpad, wav->offset, 8, &buf)) != GST_FLOW_OK) @@ -1365,6 +1366,7 @@ gst_wavparse_stream_headers (GstWavParse * wav) gst_adapter_flush (wav->adapter, GST_ROUND_UP_2 (size)); } else { gst_buffer_unref (buf); + buf = NULL; if ((res = gst_pad_pull_range (wav->sinkpad, wav->offset + 8, data_size, &buf)) != GST_FLOW_OK) @@ -1411,6 +1413,7 @@ gst_wavparse_stream_headers (GstWavParse * wav) } else { GstMapInfo map; gst_buffer_unref (buf); + buf = NULL; if ((res = gst_pad_pull_range (wav->sinkpad, wav->offset + 8, size, &buf)) != GST_FLOW_OK) @@ -1450,6 +1453,7 @@ gst_wavparse_stream_headers (GstWavParse * wav) gst_adapter_unmap (wav->adapter); } else { gst_buffer_unref (buf); + buf = NULL; if ((res = gst_pad_pull_range (wav->sinkpad, wav->offset, 12, &buf)) != GST_FLOW_OK) @@ -1477,6 +1481,7 @@ gst_wavparse_stream_headers (GstWavParse * wav) } else { wav->offset += 12; gst_buffer_unref (buf); + buf = NULL; if (data_size > 0) { if ((res = gst_pad_pull_range (wav->sinkpad, wav->offset,