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;