Fix off-by-one in verification of closed caption line length. v1.8.5
authorCarl Hetherington <cth@carlh.net>
Tue, 9 Nov 2021 22:43:46 +0000 (23:43 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 9 Nov 2021 22:43:46 +0000 (23:43 +0100)
src/verify.cc
test/verify_test.cc

index 16a3b78642fe401fb7e2a945fc9cbff954b59254..a0c329d0cdb862050a74dfe54667ce211a910be8 100644 (file)
@@ -1099,10 +1099,10 @@ verify_text_lines_and_characters (
                        result->line_count_exceeded = true;
                }
                for (auto j: current) {
-                       if (j.second >= warning_length) {
+                       if (j.second > warning_length) {
                                result->warning_length_exceeded = true;
                        }
-                       if (j.second >= error_length) {
+                       if (j.second > error_length) {
                                result->error_length_exceeded = true;
                        }
                }
index c8d0e579046db80084384a3aedb01a45b3d48e8d..dab85a239b2d0460e172fb3583c96ecc19676b20 100644 (file)
@@ -1975,6 +1975,22 @@ BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_count4)
 }
 
 
+BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_length)
+{
+       auto const dir = path ("build/test/verify_valid_closed_caption_line_length");
+       auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+               dir,
+               {
+                       { 96, 300, 0.0, dcp::VAlign::CENTER, "01234567890123456789012345678901" }
+               });
+       check_verify_result (
+               {dir},
+               {
+                       { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get() }
+               });
+}
+
+
 BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_line_length)
 {
        auto const dir = path ("build/test/verify_invalid_closed_caption_line_length");