]> git.sesse.net Git - vlc/commitdiff
Be on the safe side of memory protection for now: use PROT_WRITE.
authorRémi Denis-Courmont <rem@videolan.org>
Fri, 28 Dec 2007 17:17:29 +0000 (17:17 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Fri, 28 Dec 2007 17:17:29 +0000 (17:17 +0000)
modules/access/file.c

index eac81228ceb109c08fe783b27f9cb6aa511cf620..9f5750d317f29589b0f74841bf3b04a87b7cfd00 100644 (file)
@@ -208,7 +208,14 @@ static int Open( vlc_object_t *p_this )
     /* Autodetect mmap() support */
     if (p_sys->b_pace_control && S_ISREG (st.st_mode) && (st.st_size > 0))
     {
-        void *addr = mmap (NULL, 1, PROT_READ, MAP_PRIVATE, fd, 0);
+        /* TODO: Do not allow PROT_WRITE, we should not need it.
+         * However, this far, "block" ownership seems such that whoever
+         * "receives" a block can freely modify its content. Hence we _may_
+         * need PROT_WRITE not to default memory protection.
+         * NOTE: With MAP_PRIVATE, changes are not committed to the underlying
+         * file, write open permission is not required.
+         */
+        void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
         if (addr != MAP_FAILED)
         {
             /* Does the file system support mmap? */