From 07b03fc977f813258c056e7247c9d3a13b133b54 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 6 Dec 2019 22:21:17 +0100 Subject: Verify Id in ContentVersion. --- src/verify.cc | 3 +++ test/verify_test.cc | 12 ++++++++++++ 2 files changed, 15 insertions(+) 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 directories, function 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(" is malformed."))); + } /* Check that the CPL's hash corresponds to the PKL */ BOOST_FOREACH (shared_ptr 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, + "urn:uuid:75ac29aa", "urn:uri:7fac29aa", + dcp::VerificationNote::Code::BAD_URN_UUID, + dcp::VerificationNote::Code::CPL_HASH_INCORRECT + ); +} + -- cgit v1.2.3