diff mbox

[FFmpeg-devel] lavd/libdc1394: Avoid a null pointer dereference

Message ID CAB0OVGpM72JgXMu7uhRBXyiBTj=7-Sh=x8ub=Pwh9iwbU0osQQ@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Aug. 18, 2017, 8:02 a.m. UTC
Hi!

Attached patch - that I cannot test - is meant to fix a bug reported
at launchpad:
https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1710849

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos Aug. 18, 2017, 5:29 p.m. UTC | #1
2017-08-18 10:02 GMT+02:00 Carl Eugen Hoyos <ceffmpeg@gmail.com>:

> Attached patch - that I cannot test - is meant to fix a bug reported
> at launchpad:
> https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1710849

OK'ed by Josh de Kock with a change to prevent a leak and applied.

Carl Eugen
diff mbox

Patch

From 6db6b36a36da95de9b2bae34313710df5b126811 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Fri, 18 Aug 2017 09:56:08 +0200
Subject: [PATCH] lavd/libdc1394: Do not crash if dc1394_camera_new() fails.

Fixes Ubuntu bug 1710849
---
 libavdevice/libdc1394.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index afffd89..f435856 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -190,6 +190,13 @@  static int dc1394_read_header(AVFormatContext *c)
 
     /* FIXME: To select a specific camera I need to search in list its guid */
     dc1394->camera = dc1394_camera_new (dc1394->d, list->ids[0].guid);
+
+    if (!dc1394->camera) {
+         av_log(c, AV_LOG_ERROR, "Unable to open camera with guid 0x%"PRIx64"\n",
+                list->ids[0].guid);
+         goto out;
+    }
+
     if (list->num > 1) {
         av_log(c, AV_LOG_INFO, "Working with the first camera found\n");
     }
-- 
1.7.10.4