]> granicus.if.org Git - handbrake/commitdiff
json: fix crash when foreign audio search is *not* enabled
authorjstebbins <jstebbins.hb@gmail.com>
Wed, 11 Mar 2015 14:42:33 +0000 (14:42 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Wed, 11 Mar 2015 14:42:33 +0000 (14:42 +0000)
Also, prevent crashes that occur when the json is not properly parsed.
It will still fail to encode, but we will capture the parse failure in
the log.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6983 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/hb_json.c
libhb/work.c

index 8020221d10bdb87e89dfcc4f3bc12115ee9c10ac..0ee09f77bc44d749f821d231c315e155a0ba0596 100644 (file)
@@ -766,7 +766,7 @@ hb_job_t* hb_json_to_job( hb_handle_t * h, const char * json_job )
     // Audio {CopyMask, FallbackEncoder}
     "s?{s?i, s?i},"
     // Subtitle {Search {Enable, Forced, Default, Burn}}
-    "s?{s?{s:b, s?b, s?b, s?b}},"
+    "s?{s?{s?b, s?b, s?b, s?b}},"
     // MetaData {Name, Artist, Composer, AlbumArtist, ReleaseDate,
     //           Comment, Genre, Description, LongDescription}
     "s?{s?s, s?s, s?s, s?s, s?s, s?s, s?s, s?s, s?s},"
index 01060c01ff19e78e5da71077978c34d4310decb6..b3d0744d7cb8d87004432473b1a5897ce5365ab8 100644 (file)
@@ -106,6 +106,13 @@ static void work_func( void * _work )
 
             // Expand json string to full job struct
             hb_job_t *new_job = hb_json_to_job(job->h, job->json);
+            if (new_job == NULL)
+            {
+                hb_job_close(&job);
+                hb_list_close(&passes);
+                *work->die = 1;
+                break;
+            }
             new_job->h = job->h;
             hb_job_close(&job);
             job = new_job;