diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-12-31 22:47:05 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-01-07 22:44:55 +0100 |
| commit | e795a038d60e46d1241ea0be2ff44c75ef5b45b9 (patch) | |
| tree | 7d1bba7396895a344b24a0561648fb7715c6c0ae /src | |
| parent | 8e9b90530a743e2e981e35859bfe5fb42f465e6b (diff) | |
Check for multiple asset IDs in a PKL during verify.
Diffstat (limited to 'src')
| -rw-r--r-- | src/verify.cc | 13 | ||||
| -rw-r--r-- | src/verify.h | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/verify.cc b/src/verify.cc index 9068e9cc..a797813a 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -79,6 +79,7 @@ #include <boost/algorithm/string.hpp> #include <iostream> #include <map> +#include <set> #include <vector> @@ -88,6 +89,7 @@ using std::list; using std::make_shared; using std::map; using std::max; +using std::set; using std::shared_ptr; using std::string; using std::vector; @@ -1616,6 +1618,7 @@ verify_pkl( ) { validate_xml(pkl->file().get(), xsd_dtd_directory, notes); + if (pkl_has_encrypted_assets(dcp, pkl)) { cxml::Document doc("PackingList"); doc.read_file(pkl->file().get()); @@ -1623,6 +1626,14 @@ verify_pkl( notes.push_back({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::UNSIGNED_PKL_WITH_ENCRYPTED_CONTENT, pkl->id(), pkl->file().get()}); } } + + set<string> uuid_set; + for (auto asset: pkl->asset_list()) { + if (!uuid_set.insert(asset->id()).second) { + notes.push_back({VerificationNote::Type::ERROR, VerificationNote::Code::DUPLICATE_ASSET_ID_IN_PKL, pkl->id(), pkl->file().get()}); + break; + } + } } @@ -1899,6 +1910,8 @@ dcp::note_to_string (VerificationNote note) return String::compose("<ContentKind> has an invalid value %1.", note.note().get()); case VerificationNote::Code::INVALID_MAIN_PICTURE_ACTIVE_AREA: return String::compose("<MainPictureActiveaArea> has an invalid value: %1", note.note().get()); + case VerificationNote::Code::DUPLICATE_ASSET_ID_IN_PKL: + return String::compose("The PKL %1 has more than one asset with the same ID", note.note().get()); } return ""; diff --git a/src/verify.h b/src/verify.h index 5e2c3c1f..d565abfa 100644 --- a/src/verify.h +++ b/src/verify.h @@ -401,6 +401,11 @@ public: * file contains the CPL filename */ INVALID_MAIN_PICTURE_ACTIVE_AREA, + /** A PKL has more than one asset with the same ID + * note contains the PKL ID + * file contains the PKL filename + */ + DUPLICATE_ASSET_ID_IN_PKL }; VerificationNote (Type type, Code code) |
