[vlc-commits] stream: do not pass NULL buffer to access module

Rémi Denis-Courmont git at videolan.org
Tue Feb 7 19:10:32 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb  7 19:56:46 2017 +0200| [c95ce4f2d042eaf8d0c1b9bc709fda0c09ca92c5] | committer: Rémi Denis-Courmont

stream: do not pass NULL buffer to access module

access_t.pf_read did not expect a NULL output pointer before the merge
of access_t and stream_t. For files, this caused an EFAULT error, but
for other input types, it would likely crash.

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

 src/input/stream.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 7138280..898365b 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -364,7 +364,13 @@ static ssize_t vlc_stream_ReadRaw(stream_t *s, void *buf, size_t len)
     if (s->pf_read != NULL)
     {
         assert(priv->block == NULL);
-        ret = s->pf_read(s, buf, len);
+        if (buf == NULL)
+        {
+            char dummy[1 + (len <= 255 ? len : 255)];
+            ret = s->pf_read(s, dummy, len);
+        }
+        else
+            ret = s->pf_read(s, buf, len);
         return ret;
     }
 



More information about the vlc-commits mailing list