[DF170418-00597] Patch for invalid AVI file. data chunk size in idx1 is wrong 64/130664/2 accepted/tizen/unified/20170531.082457 submit/tizen/20170524.035356
authorHaejeong Kim <backto.kim@samsung.com>
Tue, 23 May 2017 08:45:44 +0000 (17:45 +0900)
committerHaejeong Kim <backto.kim@samsung.com>
Tue, 23 May 2017 08:47:11 +0000 (17:47 +0900)
Change-Id: I41af3ee4b9840c96ba6f1509ad661c75d6af4930

libavformat/avidec.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 54c4814..d6d4d3e
@@ -1317,12 +1317,18 @@ static int avi_read_idx1(AVFormatContext *s, int size)
         if (pb->eof_reached)
             return AVERROR_INVALIDDATA;
 
+//Add code for some invalid index size(len). if indexed data chunk size(len) is bigger than file size, not add in entry. 20170523, hjkim
         if (last_pos == pos)
             avi->non_interleaved = 1;
-        else if (len || !ast->sample_size)
+        else if (len < avi->fsize || !ast->sample_size)
             av_add_index_entry(st, pos, ast->cum_len, len, 0,
                                (flags & AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
-        ast->cum_len += get_duration(ast, len);
+
+        if (len < avi->fsize)
+            ast->cum_len += get_duration(ast, len);
+         else  //wrong size
+            av_dlog(s, "[%lld] %d %d \n", avi->fsize, i, len);
+
         last_pos      = pos;
     }
     return 0;