Skip to content

v4l2codecs: Fix segfaults when VIDIOC_REQBUFS doesn't return enough buffers

James Cowgill requested to merge jcowgill/gstreamer:v4l2codecs-reqbufs-fail into main

Running this pipeline:

gst-launch-1.0 -v filesrc location=test.mkv ! matroskademux ! v4l2slh264dec ! x264enc ! fakesink

The default settings for x264enc require more than 32 buffers which will cause VIDIOC_REQBUFS to return too few buffers.

This leads to two segfaults:

  • First we segfault in the allocator finalize function when trying to use the decoder variable when it's NULL.
  • Then (after the allocator creation has failed) we segfault in the pool creation function trying to use a NULL allocator.

Merge request reports