From 38ba954e823605099eab8b9c70b79db0543eb092 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 6 Jul 2018 13:46:17 +0200 Subject: [PATCH] typefindfunctions: Use guint32 for sizes This brings it in sync with the type used with gst_type_find_*() API --- gst/typefind/gsttypefindfunctions.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index c1c4b236b2..b260999dbf 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -55,7 +55,7 @@ typedef struct { guint64 offset; const guint8 *data; - gint size; + guint size; } DataScanCtx; static inline void @@ -72,7 +72,7 @@ data_scan_ctx_advance (GstTypeFind * tf, DataScanCtx * c, guint bytes_to_skip) } static inline gboolean -data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, gint min_len) +data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, guint min_len) { const guint8 *data; guint64 len; @@ -112,6 +112,9 @@ static inline gboolean data_scan_ctx_memcmp (GstTypeFind * tf, DataScanCtx * c, guint offset, const gchar * data, guint len) { + if (G_UNLIKELY (offset + len >= G_MAXUINT32)) + return FALSE; + if (!data_scan_ctx_ensure_data (tf, c, offset + len)) return FALSE;