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

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


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

 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..519eda0 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, sizeof (dummy));
+        }
+        else
+            ret = s->pf_read(s, buf, len);
         return ret;
     }
 



More information about the vlc-commits mailing list