mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
v4l2allocator: Add protection against driver bug
v4l2loopback driver has a this nasty bug that if the queue is larger then 2 buffers, it returns random index on dqbuf. So far we assumed that the index was always right, which would lead to memory being unref twice, and eventually crash.
This commit is contained in:
parent
3e876215b7
commit
f7c682f802
1 changed files with 7 additions and 0 deletions
|
@ -1305,6 +1305,13 @@ gst_v4l2_allocator_dqbuf (GstV4l2Allocator * allocator)
|
|||
goto error;
|
||||
|
||||
group = allocator->groups[buffer.index];
|
||||
|
||||
if (!IS_QUEUED (group->buffer)) {
|
||||
GST_ERROR_OBJECT (allocator,
|
||||
"buffer %i was not queued, this indicate a driver bug.", buffer.index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
group->buffer = buffer;
|
||||
|
||||
GST_LOG_OBJECT (allocator, "dequeued buffer %i (flags 0x%X)", buffer.index,
|
||||
|
|
Loading…
Reference in a new issue