[vlc-commits] demux: avi: improve broken index offset heuristic (fix #14120)

Francois Cartegnie git at videolan.org
Mon Mar 23 23:43:39 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 23 23:38:12 2015 +0100| [039c69d648bd9bb481fbd29868b8565952098d70] | committer: Francois Cartegnie

demux: avi: improve broken index offset heuristic (fix #14120)

Avoids using movi position as offset when the broken index refers
to beginning of file and the first sample size is exactly movi's
offset.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=039c69d648bd9bb481fbd29868b8565952098d70
---

 modules/demux/avi/avi.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 0a35b42..34a3362 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -2321,11 +2321,22 @@ static int AVI_IndexFind_idx1( demux_t *p_demux,
             *pi_offset = 0;
         else
             *pi_offset = i_movi_content;
+
+        if( p_idx1->i_entry_count )
+        {
+            /* Invalidate offset if index refers past the data section to avoid false
+               positives when the offset equals sample size */
+            size_t i_dataend = *pi_offset + p_idx1->entry[p_idx1->i_entry_count - 1].i_pos +
+                                            p_idx1->entry[p_idx1->i_entry_count - 1].i_length;
+            if( i_dataend > p_movi->i_chunk_pos + p_movi->i_chunk_size )
+                *pi_offset = 0;
+        }
     }
     else
     {
         *pi_offset = 0;
     }
+
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list