From 66b51fa529a39c299105a2081b05f9d774725fe7 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Mon, 23 Sep 2024 07:53:19 +0200 Subject: [PATCH 1/3] prevent index out of bounds --- ffplayout/src/player/utils/folder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ffplayout/src/player/utils/folder.rs b/ffplayout/src/player/utils/folder.rs index 0279998d..d650f7c3 100644 --- a/ffplayout/src/player/utils/folder.rs +++ b/ffplayout/src/player/utils/folder.rs @@ -136,7 +136,6 @@ impl Iterator for FolderSource { self.current_node .add_filter(&config, &self.manager.filter_chain); self.current_node.begin = Some(time_in_seconds()); - self.manager.current_index.fetch_add(1, Ordering::SeqCst); Some(self.current_node.clone()) @@ -155,12 +154,14 @@ impl Iterator for FolderSource { self.sort(); } - self.current_node = self.manager.current_list.lock().unwrap()[0].clone(); + self.current_node = match self.manager.current_list.lock().unwrap().get(0) { + Some(m) => m.clone(), + None => return None, + }; let _ = self.current_node.add_probe(false).ok(); self.current_node .add_filter(&config, &self.manager.filter_chain); self.current_node.begin = Some(time_in_seconds()); - self.manager.current_index.store(1, Ordering::SeqCst); Some(self.current_node.clone()) From 45a69ac003613a2ca21901551384a1d8061f77d5 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Mon, 23 Sep 2024 08:15:19 +0200 Subject: [PATCH 2/3] no panic on missing port --- ffplayout/src/main.rs | 7 ++++++- ffplayout/src/player/utils/folder.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ffplayout/src/main.rs b/ffplayout/src/main.rs index bcfc712c..97abf438 100644 --- a/ffplayout/src/main.rs +++ b/ffplayout/src/main.rs @@ -94,7 +94,12 @@ async fn main() -> std::io::Result<()> { let ip_port = conn.split(':').collect::>(); let addr = ip_port[0]; - let port = ip_port[1].parse::().unwrap(); + let port = ip_port + .get(1) + .ok_or(": needed!") + .map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))? + .parse::() + .unwrap(); let controllers = web::Data::from(channel_controllers.clone()); let auth_state = web::Data::new(SseAuthState { uuids: tokio::sync::Mutex::new(HashSet::new()), diff --git a/ffplayout/src/player/utils/folder.rs b/ffplayout/src/player/utils/folder.rs index d650f7c3..8a206e4e 100644 --- a/ffplayout/src/player/utils/folder.rs +++ b/ffplayout/src/player/utils/folder.rs @@ -154,7 +154,7 @@ impl Iterator for FolderSource { self.sort(); } - self.current_node = match self.manager.current_list.lock().unwrap().get(0) { + self.current_node = match self.manager.current_list.lock().unwrap().first() { Some(m) => m.clone(), None => return None, }; From 4a752a69b919d360fe8bade5950c9205d410e280 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Mon, 23 Sep 2024 08:22:42 +0200 Subject: [PATCH 3/3] update version --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3531e89a..909a5d42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1215,7 +1215,7 @@ checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ffplayout" -version = "0.24.0-beta4" +version = "0.24.0-rc1" dependencies = [ "actix-files", "actix-multipart", @@ -3681,7 +3681,7 @@ dependencies = [ [[package]] name = "tests" -version = "0.24.0-beta4" +version = "0.24.0-rc1" dependencies = [ "actix-rt", "actix-test", diff --git a/Cargo.toml b/Cargo.toml index 31f62efe..08244c9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["ffplayout", "tests"] resolver = "2" [workspace.package] -version = "0.24.0-beta4" +version = "0.24.0-rc1" license = "GPL-3.0" repository = "https://github.com/ffplayout/ffplayout" authors = ["Jonathan Baecker "]