Don't try to verify encrypted JPEG2000 bitstreams.
authorCarl Hetherington <cth@carlh.net>
Tue, 6 Apr 2021 12:34:23 +0000 (14:34 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 6 Apr 2021 12:34:23 +0000 (14:34 +0200)
src/verify.cc
test/verify_test.cc

index 17f54e8041d05aa6644eb4e1f929a6838388e9d5..382a67ba9e71a9517e480a9c6b234e1f1984143c 100644 (file)
@@ -441,9 +441,11 @@ verify_picture_asset (shared_ptr<const ReelFileAsset> reel_file_asset, boost::fi
                for (int64_t i = 0; i < duration; ++i) {
                        auto frame = reader->get_frame (i);
                        biggest_frame = max(biggest_frame, frame->size());
-                       vector<VerificationNote> j2k_notes;
-                       verify_j2k (frame, j2k_notes);
-                       check_and_add (j2k_notes);
+                       if (!mono_asset->encrypted() || mono_asset->key()) {
+                               vector<VerificationNote> j2k_notes;
+                               verify_j2k (frame, j2k_notes);
+                               check_and_add (j2k_notes);
+                       }
                        progress (float(i) / duration);
                }
        } else if (auto stereo_asset = dynamic_pointer_cast<StereoPictureAsset>(asset)) {
@@ -451,10 +453,12 @@ verify_picture_asset (shared_ptr<const ReelFileAsset> reel_file_asset, boost::fi
                for (int64_t i = 0; i < duration; ++i) {
                        auto frame = reader->get_frame (i);
                        biggest_frame = max(biggest_frame, max(frame->left()->size(), frame->right()->size()));
-                       vector<VerificationNote> j2k_notes;
-                       verify_j2k (frame->left(), j2k_notes);
-                       verify_j2k (frame->right(), j2k_notes);
-                       check_and_add (j2k_notes);
+                       if (!stereo_asset->encrypted() || mono_asset->key()) {
+                               vector<VerificationNote> j2k_notes;
+                               verify_j2k (frame->left(), j2k_notes);
+                               verify_j2k (frame->right(), j2k_notes);
+                               check_and_add (j2k_notes);
+                       }
                        progress (float(i) / duration);
                }
 
index e1ab50ce0851d20635cd3643a756a5273a18c7f7..b4cbc5aa2f7342fbef883f94b7f86388bc89011e 100644 (file)
@@ -2688,8 +2688,6 @@ BOOST_AUTO_TEST_CASE (verify_unsigned_cpl_with_encrypted_content)
                {
                        { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, encryption_test_cpl_id, canonical(cpl) },
                        { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL, encryption_test_pkl_id, canonical(pkl), },
-                       /* It's encrypted so the J2K validity checks will fail */
-                       { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string("missing marker start byte") },
                        { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE },
                        { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE },
                        { dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::MISSING_FFOC },
@@ -2719,8 +2717,6 @@ BOOST_AUTO_TEST_CASE (verify_unsigned_pkl_with_encrypted_content)
                {dir},
                {
                        { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL, encryption_test_pkl_id, canonical(pkl) },
-                       /* It's encrypted so the J2K validity checks will fail */
-                       { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string("missing marker start byte") },
                        { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE },
                        { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE },
                        { dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::MISSING_FFOC },
@@ -2807,8 +2803,6 @@ BOOST_AUTO_TEST_CASE (verify_partially_encrypted)
                {dir},
                {
                        {dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::PARTIALLY_ENCRYPTED},
-                       /* It's encrypted so the J2K validity checks will fail */
-                       {dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string("missing marker start byte")}
                });
 }