From 0dcb1e4eccf83e3d71ea6e47daca81c2d8bf0d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 14 Mar 2017 19:27:45 +0200 Subject: [PATCH] dashdemux: Add assertion for preventing of access after the end of the sidx entries array Better crash cleanly here than reading some random numbers from memory. --- ext/dash/gstdashdemux.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index 0e88864f4f..a178fd6369 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -292,7 +292,14 @@ static GTimeSpan gst_dash_demux_get_clock_compensation (GstDashDemux * demux); static GDateTime *gst_dash_demux_get_server_now_utc (GstDashDemux * demux); #define SIDX(s) (&(s)->sidx_parser.sidx) -#define SIDX_ENTRY(s,i) (&(SIDX(s)->entries[(i)])) + +static inline GstSidxBoxEntry * +SIDX_ENTRY (GstDashDemuxStream * s, gint i) +{ + g_assert (i < SIDX (s)->entries_count); + return &(SIDX (s)->entries[(i)]); +} + #define SIDX_CURRENT_ENTRY(s) SIDX_ENTRY(s, SIDX(s)->entry_index) static void gst_dash_demux_send_content_protection_event (gpointer cp_data,