[vlc-commits] [Git][videolan/vlc][3.0.x] demux: ogg: fix last page probing

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Thu Dec 22 07:58:25 UTC 2022



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
6183d1e1 by Francois Cartegnie at 2022-12-22T07:43:08+00:00
demux: ogg: fix last page probing

properly process the full search window instead of returning the first page found

change lower search range stop condition to fix parsing bug on lowest
window

refs #27610

(cherry picked from commit efcb930b250de59dbaad59a4e5364292a32188b1)

- - - - -


1 changed file:

- modules/demux/oggseek.c


Changes:

=====================================
modules/demux/oggseek.c
=====================================
@@ -276,22 +276,30 @@ void Oggseek_ProbeEnd( demux_t *p_demux )
                     break;
                 }
             }
+            /* We found at least a page with valid granule */
             if ( i_length > 0 ) break;
         }
 
-        /* We found at least a page with valid granule */
-        if ( i_length > 0 ) break;
+        if( i_startpos == i_lowerbound ||
+            p_sys->i_length != 0 )
+            goto clean;
+
+        int64_t i_next_upperbound = __MIN(i_startpos + MIN_PAGE_SIZE, i_upperbound);
 
         /* Otherwise increase read size, starting earlier */
-        if ( i_backoffset <= ( UINT_MAX >> 1 ) )
+        if ( i_backoffset <= MAX_PAGE_SIZE )
         {
             i_backoffset <<= 1;
             i_startpos = i_upperbound - i_backoffset;
         }
         else
         {
-            i_startpos -= i_backoffset;
+            i_startpos = i_upperbound - MAX_PAGE_SIZE;
         }
+
+        i_upperbound = i_next_upperbound;
+
+        i_startpos = __MAX( i_startpos, i_lowerbound );
         i_pos = i_startpos;
 
         if ( vlc_stream_Seek( p_demux->s, i_pos ) )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6183d1e1530e5fee926a4fbbae8fe8628a2bcd57

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6183d1e1530e5fee926a4fbbae8fe8628a2bcd57
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list