mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 13:02:29 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/445>
This commit is contained in:
parent
166c0fbc47
commit
358d4e991a
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue