mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
stream_file: allow to open only our fd in case of fuzzing
This ensures that we don't open some other fd, for example when loading playlist. Also filters out loading any local files. This also allows to remove custom filtering from fuzzer itself.
This commit is contained in:
@@ -1182,18 +1182,6 @@ static void start_open(struct MPContext *mpctx, char *url, int url_flags,
|
||||
mpctx->open_for_prefetch = for_prefetch && mpctx->opts->demuxer_thread;
|
||||
mpctx->demuxer_changed = false;
|
||||
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
// Don't allow to open local paths or stdin during fuzzing
|
||||
bstr open_url = bstr0(mpctx->open_url);
|
||||
if (bstr_startswith0(open_url, "/") ||
|
||||
bstr_startswith0(open_url, ".") ||
|
||||
bstr_equals0(open_url, "-"))
|
||||
{
|
||||
cancel_open(mpctx);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mp_thread_create(&mpctx->open_thread, open_demux_thread, mpctx)) {
|
||||
cancel_open(mpctx);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user