From 358d4e991ab3d35a100395ca1bed397c9d00ff50 Mon Sep 17 00:00:00 2001 From: Juan Navarro Date: Wed, 22 Apr 2020 18:59:54 +0200 Subject: [PATCH] gstcaps: fix out of bounds checks These two checks could end up allowing out of bounds array access, when the index equals the array size. Part-of: --- gst/gstcaps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/gstcaps.c b/gst/gstcaps.c index bfa6011a3b..aa4a34d900 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -708,7 +708,7 @@ gst_caps_remove_structure (GstCaps * caps, guint idx) GstStructure *structure; g_return_if_fail (caps != NULL); - g_return_if_fail (idx <= gst_caps_get_size (caps)); + g_return_if_fail (idx < gst_caps_get_size (caps)); g_return_if_fail (IS_WRITABLE (caps)); structure = gst_caps_remove_and_get_structure (caps, idx); @@ -958,7 +958,7 @@ gst_caps_set_features (GstCaps * caps, guint index, GstCapsFeatures * features) GstCapsFeatures **storage, *old; g_return_if_fail (caps != NULL); - g_return_if_fail (index <= gst_caps_get_size (caps)); + g_return_if_fail (index < gst_caps_get_size (caps)); g_return_if_fail (IS_WRITABLE (caps)); storage = gst_caps_get_features_storage_unchecked (caps, index);