From 614b04336ce6b5eb1a14101b4496e48e1d456b58 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Wed, 12 Dec 2018 14:04:34 +0900 Subject: [PATCH] asfdemux : Return error if parsed data size is zero - Fix hangs while playing certain asf files Change-Id: I8b34c7a24d7e113983cc7fd6862df5140ee2bade --- gst/asfdemux/gstasfdemux.c | 11 ++++++++--- packaging/gst-plugins-ugly.spec | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index d81ad167..bd820fa6 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -1192,7 +1192,12 @@ gst_asf_demux_parse_data_object_start (GstASFDemux * demux, guint8 * data) "data_offset=%" G_GINT64_FORMAT ", data_size=%" G_GINT64_FORMAT ", index_offset=%" G_GUINT64_FORMAT, demux->num_packets, demux->data_offset, demux->data_size, demux->index_offset); - +#ifdef TIZEN_FEATURE_ASFDEMUX_CHECK_DATA_SIZE + if (demux->data_size == 0) { + GST_WARNING_OBJECT (demux, "DATA object size is zero"); + return FALSE; + } +#endif return TRUE; } @@ -1434,7 +1439,7 @@ gst_asf_demux_check_first_ts (GstASFDemux * demux, gboolean force) /* there are some DVR ms files where first packet has TS of 0 (instead of -1) while subsequent packets have regular (singificantly larger) timestamps. If we don't deal with it, we may end up with huge gap in timestamps - which makes playback stuck. The 0 timestamp may also be valid though, if the second packet timestamp continues + which makes playback stuck. The 0 timestamp may also be valid though, if the second packet timestamp continues from it. I havent found a better way to distinguish between these two, except to set an arbitrary boundary and disregard the first 0 timestamp if the second timestamp is bigger than the boundary) */ @@ -2677,7 +2682,7 @@ gst_asf_demux_add_audio_stream (GstASFDemux * demux, src_pad = gst_pad_new_from_static_template (&audio_src_template, name); g_free (name); - /* Swallow up any left over data and set up the + /* Swallow up any left over data and set up the * standard properties from the header info */ if (size_left) { GST_INFO_OBJECT (demux, "Audio header contains %d bytes of " diff --git a/packaging/gst-plugins-ugly.spec b/packaging/gst-plugins-ugly.spec index d002dee5..ae572368 100644 --- a/packaging/gst-plugins-ugly.spec +++ b/packaging/gst-plugins-ugly.spec @@ -40,6 +40,7 @@ export CFLAGS="\ %if "%{tizen_profile_name}" == "tv" -DTIZEN_FEATURE_TRUSTZONE\ %endif + -DTIZEN_FEATURE_ASFDEMUX_CHECK_DATA_SIZE\ -fstack-protector-strong\ -Wl,-z,relro\ -D_FORTIFY_SOURCE=2" -- 2.34.1