diff options
author | Dudemanguy <random342@airmail.cc> | 2023-08-14 14:13:02 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-08-16 13:01:28 +0000 |
commit | 0b4a36476d0efcb4715a56c6e6de241af9a4b9ec (patch) | |
tree | c9de7619cb191d1aab5a66ce3e0c969a9f62cec2 /player/core.h | |
parent | f19bafc0e442dedf3573e92e1cd4ef332217924d (diff) | |
download | mpv-0b4a36476d0efcb4715a56c6e6de241af9a4b9ec.tar.bz2 mpv-0b4a36476d0efcb4715a56c6e6de241af9a4b9ec.tar.xz |
loadfile: avoid infinite playlist loading loops
There are a number of ways one can craft a playlist file that refers to
itself or cleverly goes around in a loop to other playlist files. There
is obviously no use for this, but mpv spins around forever trying to
load the files so you have to just SIGTERM/SIGKILL it. We can be smarter
about this and attempt to detect it. The condition for detecting this is
surprisingly simple: the filename of the first entry in the playlist
must match a previous playlist path we stored. If we get this, we can
then log an error and stop playback. If there is a "real" file loaded at
any point in time, then we know it's not an infinite loop and clear out
the saved playlist paths. Fixes #3967.
Diffstat (limited to 'player/core.h')
-rw-r--r-- | player/core.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/player/core.h b/player/core.h index 3ea862462d..9b60add51d 100644 --- a/player/core.h +++ b/player/core.h @@ -275,6 +275,8 @@ typedef struct MPContext { struct playlist_entry *playing; // currently playing file char *filename; // immutable copy of playing->filename (or NULL) char *stream_open_filename; + char **playlist_paths; // used strictly for playlist validation + int playlist_paths_len; enum stop_play_reason stop_play; bool playback_initialized; // playloop can be run/is running int error_playing; |