mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-07 15:02:40 +00:00
gstbuffer: Fix range iteration
We want to iterate over items idx to idx + length We use the len variable as the corrected number of memory to iterate and then properly go over all items. Fixes the issue where specifying any idx different from 0 had no effect Spotted by clang static analyzer
This commit is contained in:
parent
876af7b343
commit
c7295cf4b9
1 changed files with 4 additions and 2 deletions
|
@ -1204,10 +1204,12 @@ gst_buffer_is_memory_range_writable (GstBuffer * buffer, guint idx, gint length)
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
if (length == -1)
|
if (length == -1)
|
||||||
length = len - idx;
|
len -= idx;
|
||||||
|
else
|
||||||
|
len = length;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (!gst_memory_is_writable (GST_BUFFER_MEM_PTR (buffer, i)))
|
if (!gst_memory_is_writable (GST_BUFFER_MEM_PTR (buffer, i + idx)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue