summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-12-06 22:21:17 +0100
committerCarl Hetherington <cth@carlh.net>2019-12-22 01:21:00 +0100
commit07b03fc977f813258c056e7247c9d3a13b133b54 (patch)
treefa80f34f55cd9b8d472cc8130115f5df6e59dede
parent2f874428086c0bd47e6efa31970be9f442e087f4 (diff)
Verify Id in ContentVersion.
-rw-r--r--src/verify.cc3
-rw-r--r--test/verify_test.cc12
2 files changed, 15 insertions, 0 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 032a3f39..6611b7b3 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -170,6 +170,9 @@ dcp::verify (vector<boost::filesystem::path> directories, function<void (string,
if (!good_date(cpl_doc.string_child("IssueDate"))) {
notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::Code::BAD_DATE, string("CPL <IssueDate> is malformed")));
}
+ if (cpl->standard() && cpl->standard().get() == SMPTE && !good_urn_uuid(cpl_doc.node_child("ContentVersion")->string_child("Id"))) {
+ notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::Code::BAD_URN_UUID, string("<ContentVersion> <Id> is malformed.")));
+ }
/* Check that the CPL's hash corresponds to the PKL */
BOOST_FOREACH (shared_ptr<PKL> i, dcp->pkls()) {
diff --git a/test/verify_test.cc b/test/verify_test.cc
index ba6d6b22..67103ff2 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -329,3 +329,15 @@ BOOST_AUTO_TEST_CASE (verify_test10)
dcp::VerificationNote::Code::CPL_HASH_INCORRECT
);
}
+
+/* Badly formatted ContentVersion/Id */
+BOOST_AUTO_TEST_CASE (verify_test11)
+{
+ check_after_replace (
+ 11, &cpl,
+ "<Id>urn:uuid:75ac29aa", "<Id>urn:uri:7fac29aa",
+ dcp::VerificationNote::Code::BAD_URN_UUID,
+ dcp::VerificationNote::Code::CPL_HASH_INCORRECT
+ );
+}
+