[vlc-commits] prefetch: do not assume CAN_FASTSEEK succeeds

Rémi Denis-Courmont git at videolan.org
Fri Dec 20 17:18:50 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Dec 20 18:16:44 2019 +0200| [8511f5108651b66f8f0d91127fa81b9a5cf8ddbc] | committer: Rémi Denis-Courmont

prefetch: do not assume CAN_FASTSEEK succeeds

Originally all access plugins were guaranteed to handle
ACCESS_CAN_FASTSEEK one way or the other. Now that demux and access
plugins use the same capability, this assumption no longer holds.

This fixes an unitialized read.

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

 modules/stream_filter/prefetch.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c
index 2991c002bd..2f610c65bd 100644
--- a/modules/stream_filter/prefetch.c
+++ b/modules/stream_filter/prefetch.c
@@ -429,11 +429,13 @@ static int Open(vlc_object_t *obj)
     stream_t *stream = (stream_t *)obj;
 
     bool fast_seek;
+
+    if (vlc_stream_Control(stream->s, STREAM_CAN_FASTSEEK, &fast_seek))
+        return VLC_EGENERIC; /* not a byte stream */
     /* For local files, the operating system is likely to do a better work at
      * caching/prefetching. Also, prefetching with this module could cause
      * undesirable high load at start-up. Lastly, local files may require
      * support for title/seekpoint and meta control requests. */
-    vlc_stream_Control(stream->s, STREAM_CAN_FASTSEEK, &fast_seek);
     if (fast_seek)
         return VLC_EGENERIC;
 



More information about the vlc-commits mailing list