]> git.sesse.net Git - x264/commitdiff
Workaround for FFMS indexing bug
authorHenrik Gramner <henrik@gramner.com>
Tue, 27 Aug 2013 22:50:31 +0000 (00:50 +0200)
committerFiona Glaser <fiona@x264.com>
Tue, 27 Aug 2013 23:05:38 +0000 (16:05 -0700)
If FFMS_ReadIndex is used with an empty index file it gets stuck in an infinite loop instead of returning NULL
like it's supposed to do on failure. Explicitly check if the file is empty before calling it as a workaround.

input/ffms.c

index 054728b258026fc0bdf6ef0f92964b3e8ad7ef52..5c80fd9d1e488f9394742a18f0f183371c8a2528 100644 (file)
@@ -105,7 +105,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
     {
         x264_struct_stat index_s, input_s;
         if( !x264_stat( opt->index_file, &index_s ) && !x264_stat( psz_filename, &input_s ) &&
-            input_s.st_mtime < index_s.st_mtime )
+            input_s.st_mtime < index_s.st_mtime && index_s.st_size )
             idx = FFMS_ReadIndex( idx_filename, &e );
     }
     if( !idx )