[FFmpeg-devel] [PATCH] avcodec/v4l2_m2m: Fix segmentation fault due to a missing NULL check in v4l2_context.c

Eslam Samy eslamsamy226 at yahoo.com
Tue Feb 18 13:24:14 EET 2025


---
 libavcodec/v4l2_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index be1df3785b..ea11a689bc 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -329,7 +329,7 @@ start:
         /* if we are trying to get free buffers but none have been queued yet,
          * or if no buffers have been allocated yet, no need to raise a warning
          */
-        if (timeout == 0) {
+        if ((timeout == 0) && (ctx->buffers != NULL)) {
             if (!ctx->buffers)
                 return NULL;
 
-- 
2.43.0



More information about the ffmpeg-devel mailing list