From b4696a8776f69d6ed7bea01653d1cb6e62b6a8e9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 25 May 2015 14:57:47 +0100 Subject: [PATCH] 48393469730c8fb8759cc41d50c95c26380991be from master; block possibly bad characters from DCP names. --- ChangeLog | 5 +++++ TO_PORT | 3 --- src/lib/film.cc | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58f0d68d4..64c253550 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2015-05-25 Carl Hetherington + * Block all but alphanumeric characters with a few bits + of punctuation from DCP names. + + * Improve view of jobs in various ways. + * Increase the number of images that DCP-o-matic will keep around in memory before resorting to pushing them to disk. diff --git a/TO_PORT b/TO_PORT index b97043bb1..146714d5e 100644 --- a/TO_PORT +++ b/TO_PORT @@ -1,6 +1,3 @@ -33a2bece96b7875134c99a2053a2fc59e828ae33 -b41b6528fbe0d270415a8500a612da19469e49e4 -c040b70eb777630ef0fdbb80cd419f6b3da4b46e ea2becf3a859bc38c783d15f165d71f2ccb8c1d6 21cb435ed5eb250a7f94887ddd75f6b367ea231f Multi-stream audio stuff. diff --git a/src/lib/film.cc b/src/lib/film.cc index 0af4c5611..e5c5d9312 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -656,11 +656,26 @@ Film::isdcf_name (bool if_created_now) const string Film::dcp_name (bool if_created_now) const { + string unfiltered; if (use_isdcf_name()) { - return isdcf_name (if_created_now); + unfiltered = isdcf_name (if_created_now); + } else { + unfiltered = name (); } - return name(); + /* Filter out `bad' characters which cause problems with some systems. + There's no apparent list of what really is allowed, so this is a guess. + */ + + string filtered; + string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; + for (size_t i = 0; i < unfiltered.size(); ++i) { + if (allowed.find (unfiltered[i]) != string::npos) { + filtered += unfiltered[i]; + } + } + + return filtered; } void -- 2.30.2