asfdemux : Return error if parsed data size is zero
authorGilbok Lee <gilbok.lee@samsung.com>
Wed, 12 Dec 2018 05:04:34 +0000 (14:04 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Wed, 26 Dec 2018 02:17:08 +0000 (11:17 +0900)
  - Fix hangs while playing certain asf files

Change-Id: I8b34c7a24d7e113983cc7fd6862df5140ee2bade

gst/asfdemux/gstasfdemux.c
packaging/gst-plugins-ugly.spec

index d81ad16..bd820fa 100644 (file)
@@ -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 "
index d002dee..ae57236 100644 (file)
@@ -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"