Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
529
Issue boards
Milestones
Wiki
Code
Merge requests
15
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
cbac7817
Commit
cbac7817
authored
2 years ago
by
Nicolas Pomepuy
Committed by
Duncan McNamara
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Prevent the thumb provider to distribute files from outside the thumbnails cache
parent
1e89a2a6
No related branches found
No related tags found
1 merge request
!1661
Prevent the thumb provider to distribute files from outside the thumbnails cache
Pipeline
#306480
passed with stage
in 8 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/vlc-android/src/org/videolan/vlc/FileProvider.kt
+3
-0
3 additions, 0 deletions
application/vlc-android/src/org/videolan/vlc/FileProvider.kt
with
3 additions
and
0 deletions
application/vlc-android/src/org/videolan/vlc/FileProvider.kt
+
3
−
0
View file @
cbac7817
...
...
@@ -5,7 +5,9 @@ import android.content.ContentValues
import
android.database.Cursor
import
android.net.Uri
import
android.os.ParcelFileDescriptor
import
org.videolan.medialibrary.interfaces.Medialibrary
import
org.videolan.resources.AndroidDevices
import
org.videolan.resources.AppContextProvider
import
java.io.File
import
java.io.FileNotFoundException
...
...
@@ -30,6 +32,7 @@ class FileProvider : ContentProvider() {
override
fun
openFile
(
uri
:
Uri
,
mode
:
String
):
ParcelFileDescriptor
{
val
path
=
uri
.
path
?:
throw
SecurityException
(
"Illegal access"
)
if
(
path
.
contains
(
".."
))
throw
SecurityException
(
"Illegal access"
)
if
(!
path
.
startsWith
(
AppContextProvider
.
appContext
.
getExternalFilesDir
(
null
)
!!
.
absolutePath
+
Medialibrary
.
MEDIALIB_FOLDER_NAME
))
throw
SecurityException
(
"Illegal access"
)
val
file
=
File
(
path
)
if
(!
AndroidDevices
.
mountBL
.
any
{
file
.
canonicalPath
.
startsWith
(
it
)
})
throw
SecurityException
(
"Illegal access"
)
if
(
file
.
exists
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment