From 2276e7677b5fc9154bc5019325100da96ca9967a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Aug 2012 22:19:03 +0200 Subject: mapper: fix potential crash in file permission check --- NEWS | 1 + src/mapper.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 4aaa75ca2..ea40aa8a8 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ ver 0.17.2 (2012/??/??) - httpd: use monotonic clock, avoid hiccups after system clock adjustment - httpd: fix throttling bug after resuming playback * mapper: fix non-UTF8 music directory name +* mapper: fix potential crash in file permission check ver 0.17.1 (2012/07/31) diff --git a/src/mapper.c b/src/mapper.c index 6a968e32d..7db74b1af 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -93,10 +93,10 @@ check_directory(const char *path) #endif DIR *dir = opendir(path); - if (dir == NULL && errno == EACCES) - g_warning("No permission to read directory: %s", path); - else + if (dir != NULL) closedir(dir); + else if (errno == EACCES) + g_warning("No permission to read directory: %s", path); } static void -- cgit v1.2.3 From faa4fff4dd76b4f65752dec8865e4007986669d6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Aug 2012 22:45:03 +0200 Subject: filter/volume: include cleanup --- src/filter/volume_filter_plugin.c | 1 - src/volume.c | 1 - 2 files changed, 2 deletions(-) diff --git a/src/filter/volume_filter_plugin.c b/src/filter/volume_filter_plugin.c index e52c0a463..3260e8989 100644 --- a/src/filter/volume_filter_plugin.c +++ b/src/filter/volume_filter_plugin.c @@ -26,7 +26,6 @@ #include "pcm_buffer.h" #include "pcm_volume.h" #include "audio_format.h" -#include "player_control.h" #include #include diff --git a/src/volume.c b/src/volume.c index 819e6fbfa..d3ce47dd4 100644 --- a/src/volume.c +++ b/src/volume.c @@ -20,7 +20,6 @@ #include "config.h" #include "volume.h" #include "conf.h" -#include "player_control.h" #include "idle.h" #include "pcm_volume.h" #include "output_all.h" -- cgit v1.2.3 From 19ed233118bf2d3af07103dc80ceb6f5a3466b00 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Aug 2012 22:47:08 +0200 Subject: playlist: fix unprotected player_control access --- src/playlist.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/playlist.c b/src/playlist.c index 0c9eea92d..d62865dd1 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -239,9 +239,13 @@ playlist_sync(struct playlist *playlist, struct player_control *pc) if (pc_next_song == NULL && playlist->queued != -1) playlist_song_started(playlist, pc); + player_lock(pc); + pc_next_song = pc->next_song; + player_unlock(pc); + /* make sure the queued song is always set (if possible) */ - if (pc->next_song == NULL && playlist->queued < 0) + if (pc_next_song == NULL && playlist->queued < 0) playlist_update_queued_song(playlist, pc, NULL); } } -- cgit v1.2.3 From 9374e0f4454ff5a37f70ce2d6110d5612856a169 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Aug 2012 22:51:48 +0200 Subject: player_thread: add local variable "start_ms" Just in case "song" becomes invalid at some point. --- src/player_thread.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/player_thread.c b/src/player_thread.c index c0243fa00..eaf6df303 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -450,6 +450,8 @@ static bool player_seek_decoder(struct player *player) assert(pc->next_song != NULL); + const unsigned start_ms = song->start_ms; + if (decoder_current_song(dc) != song) { /* the decoder is already decoding the "next" song - stop it and start the previous song again */ @@ -498,7 +500,7 @@ static bool player_seek_decoder(struct player *player) if (where < 0.0) where = 0.0; - if (!dc_seek(dc, where + song->start_ms / 1000.0)) { + if (!dc_seek(dc, where + start_ms / 1000.0)) { /* decoder failure */ player_command_finished(pc); return false; -- cgit v1.2.3