[gegl] ff-load: avoid crash on invalid path



commit 766c245ea84024f8ed20f1b61bf4d351e91fdf82
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Mar 12 22:14:16 2017 +0100

    ff-load: avoid crash on invalid path

 operations/external/ff-load.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index 230163a..e7fd140 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -415,10 +415,11 @@ prepare (GeglOperation *operation)
 
   gegl_operation_set_format (operation, "output", babl_format ("R'G'B' u8"));
 
-  if (!p->loadedfilename ||
+  if (o->path && 
+      (!p->loadedfilename ||
       strcmp (p->loadedfilename, o->path) ||
        p->prevframe > o->frame  /* a bit heavy handed, but improves consistency */
-      )
+      ))
     {
       gint i;
       gchar *dereferenced_path;
@@ -426,6 +427,8 @@ prepare (GeglOperation *operation)
 
       ff_cleanup (o);
       dereferenced_path = realpath (o->path, NULL);
+      if (!dereferenced_path)
+        return;
       err = avformat_open_input(&p->video_fcontext, dereferenced_path, NULL, 0);
       free (dereferenced_path);
       if (err < 0)
@@ -680,7 +683,7 @@ process (GeglOperation       *operation,
   Priv       *p = (Priv*)o->user_data;
 
   {
-    if (p->video_fcontext && !decode_frame (operation, o->frame))
+    if (o->path && p->video_fcontext && !decode_frame (operation, o->frame))
       {
         long sample_start = 0;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]