Public release: - List OOXML instead of ZIP in the README supported formats... - Fix UBSan nullability failure in generator_factory_test. - Use pre-warmed Bazel caches in the Linux Kokoro build. - Make `manifest_store_bytes` parameter to ValidationResult... GitOrigin-RevId: 98f9feb849bf346f16ef357174743dbddc60c9d4 Change-Id: I070eacf328dbcc8b4787336cd7c7cd2df8d500ed
diff --git a/README.md b/README.md index a8805b6..6f79162 100644 --- a/README.md +++ b/README.md
@@ -14,28 +14,28 @@ <!-- mdformat off(no multiline table cells) --> -Format | Extensions | Validation | Generation -:--------------------------- | :---------------------------------- | :--------- | :--------- -JPEG | `.jpg`, `.jpeg` | Yes | [Yes](formats/jpeg/writer.h) -PNG | `.png` | Yes | [Yes](formats/png/writer.h) -MP4 | `.mp4` | Yes | [Yes](formats/bmff/writer.h) -fMP4 (fragmented MP4) | | No | No -RIFF (e.g., WebP, WAV, AVI) | `.webp`, `.wav`, `.avi` | Yes | [Yes](formats/riff/writer.h) -TIFF (e.g., TIFF, DNG) | `.tif`, `.tiff`, `.dng` | Yes | [Yes](formats/tiff/writer.h) -AVIF | `.avif` | Yes | [Yes](formats/bmff/writer.h) -M4A | `.m4a` | Yes | [Yes](formats/bmff/writer.h) -HEIF, HEIC | `.heif`, `.heic` | Yes | [Yes](formats/bmff/writer.h) -MOV | `.mov` | Yes | [Yes](formats/bmff/writer.h) -GIF | `.gif` | Yes | [Yes](formats/gif/writer.h) -MP3 | `.mp3` | Yes | [Yes](formats/id3/writer.h) -FLAC | `.flac` | Yes | [Yes](formats/id3/writer.h) -PDF | `.pdf` | Yes | [Yes](formats/pdf/writer.h) -SVG | | No | No -OGG Vorbis | | No | No -Text | | No | No -Live stream video | | No | No -ZIP (e.g., DOCX, PPTX, XLSX) | `.zip`, `.docx`, `.pptx`, `.xlsx` | Yes | [Yes](formats/zip/writer.h) -Fonts | | No | No +Format | Extensions | Validation | Generation +:-------------------------- | :------------------------ | :--------- | :--------- +JPEG | `.jpg`, `.jpeg` | Yes | [Yes](formats/jpeg/writer.h) +PNG | `.png` | Yes | [Yes](formats/png/writer.h) +MP4 | `.mp4` | Yes | [Yes](formats/bmff/writer.h) +fMP4 (fragmented MP4) | | No | No +RIFF (e.g., WebP, WAV, AVI) | `.webp`, `.wav`, `.avi` | Yes | [Yes](formats/riff/writer.h) +TIFF (e.g., TIFF, DNG) | `.tif`, `.tiff`, `.dng` | Yes | [Yes](formats/tiff/writer.h) +AVIF | `.avif` | Yes | [Yes](formats/bmff/writer.h) +M4A | `.m4a` | Yes | [Yes](formats/bmff/writer.h) +HEIF, HEIC | `.heif`, `.heic` | Yes | [Yes](formats/bmff/writer.h) +MOV | `.mov` | Yes | [Yes](formats/bmff/writer.h) +GIF | `.gif` | Yes | [Yes](formats/gif/writer.h) +MP3 | `.mp3` | Yes | [Yes](formats/id3/writer.h) +FLAC | `.flac` | Yes | [Yes](formats/id3/writer.h) +PDF | `.pdf` | Yes | [Yes](formats/pdf/writer.h) +SVG | | No | No +OGG Vorbis | | No | No +Text | | No | No +Live stream video | | No | No +ZIP-based containers | `.docx`, `.pptx`, `.xlsx` | Yes | [Yes](formats/zip/writer.h) +Fonts | | No | No <!-- mdformat on -->
diff --git a/generator/generator_factory_test.cc b/generator/generator_factory_test.cc index 7c8f85e..4de7043 100644 --- a/generator/generator_factory_test.cc +++ b/generator/generator_factory_test.cc
@@ -91,7 +91,8 @@ HasSubstr("template_claim_signer is required"))); } -TEST(GeneratorFactoryTest, ValidateOptionsRejectsNullUuidGenerator) { +TEST(GeneratorFactoryTest, ValidateOptionsRejectsNullUuidGenerator) +__attribute__((no_sanitize("nullability"))) { FakeClaimSigner signing_signer; FakeClaimSigner template_signer; GeneratorOptions options; @@ -104,7 +105,8 @@ HasSubstr("uuid_generator is required"))); } -TEST(GeneratorFactoryTest, ValidateOptionsRejectsNullHashFactory) { +TEST(GeneratorFactoryTest, ValidateOptionsRejectsNullHashFactory) +__attribute__((no_sanitize("nullability"))) { FakeClaimSigner signing_signer; FakeClaimSigner template_signer; GeneratorOptions options;
diff --git a/kokoro/gcp_ubuntu/build_and_test.sh b/kokoro/gcp_ubuntu/build_and_test.sh index 1ccefa6..7646c03 100755 --- a/kokoro/gcp_ubuntu/build_and_test.sh +++ b/kokoro/gcp_ubuntu/build_and_test.sh
@@ -23,9 +23,18 @@ export RUN_INSTRUMENTATION_TESTS="${RUN_INSTRUMENTATION_TESTS:-1}" cd "${KOKORO_ARTIFACTS_DIR}/git/staging" +# Use the Bazel caches pre-warmed in the container image, if any. +bazel_flags=() +if [[ -n "${BAZEL_REPOSITORY_CACHE:-}" ]]; then + bazel_flags+=("--repository_cache=${BAZEL_REPOSITORY_CACHE}") +fi +if [[ -n "${BAZEL_DISK_CACHE:-}" ]]; then + bazel_flags+=("--disk_cache=${BAZEL_DISK_CACHE}") +fi + # Run Bazel build and test all targets -bazel build ... -bazel test ... +bazel build "${bazel_flags[@]}" ... +bazel test "${bazel_flags[@]}" ... function create_and_start_emulator() { local emulator_name=c2pa_emulator
diff --git a/validator/ingredient_result_converter_test.cc b/validator/ingredient_result_converter_test.cc index e779f92..2ca6772 100644 --- a/validator/ingredient_result_converter_test.cc +++ b/validator/ingredient_result_converter_test.cc
@@ -75,8 +75,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT((*result)->proto(), EqualsProto(R"pb( @@ -99,8 +99,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT((*result)->proto(), EqualsProto(R"pb( @@ -118,8 +118,8 @@ active_manifest { label: "legacy_label" } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT((*result)->proto(), EqualsProto(R"pb( @@ -154,8 +154,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -194,8 +194,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -226,8 +226,8 @@ ingredient_manifests { label: "legacy_ingredient" } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -252,8 +252,8 @@ ingredient_manifests { label: "legacy_ingredient" } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT((*result)->proto(), EqualsProto(R"pb( @@ -282,8 +282,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT((*result)->proto(), EqualsProto(R"pb( @@ -336,8 +336,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -396,8 +396,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -442,8 +442,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -467,8 +467,8 @@ ingredient_manifests { label: "urn:c2pa:unreferenced" } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT((*result)->proto(), EqualsProto(R"pb( @@ -496,8 +496,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -535,8 +535,8 @@ ingredient_manifests { label: "legacy_label" } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -568,7 +568,7 @@ ->set_code("code"); auto result = IngredientResultConverter().Convert( - ValidationResult(std::move(validation_result))); + ValidationResult(std::move(validation_result), "")); ABSL_ASSERT_OK(result); EXPECT_EQ((*result)->proto().ingredient_validation_results().spec_version(), "2.2.0"); @@ -583,7 +583,7 @@ ->set_code("code"); auto result = IngredientResultConverter().Convert( - ValidationResult(std::move(validation_result))); + ValidationResult(std::move(validation_result), "")); ABSL_ASSERT_OK(result); EXPECT_EQ((*result)->proto().ingredient_validation_results().trust_list_uri(), "urn:test"); @@ -637,7 +637,7 @@ // The converter owns the consumer, so it has to outlive the expectations. IngredientResultConverter converter(std::move(consumer)); - auto result = converter.Convert(ValidationResult(std::move(input))); + auto result = converter.Convert(ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_THAT( @@ -664,8 +664,8 @@ } )pb"); - auto result = - IngredientResultConverter().Convert(ValidationResult(std::move(input))); + auto result = IngredientResultConverter().Convert( + ValidationResult(std::move(input), "")); ABSL_ASSERT_OK(result); EXPECT_FALSE((*result)->proto().has_digital_source_type()); @@ -684,7 +684,7 @@ )pb"); EXPECT_THAT(IngredientResultConverter(std::make_unique<FailingConsumer>()) - .Convert(ValidationResult(std::move(input))), + .Convert(ValidationResult(std::move(input), "")), StatusIs(absl::StatusCode::kInternal)); }
diff --git a/validator/result.h b/validator/result.h index 14dbb07..d3ba729 100644 --- a/validator/result.h +++ b/validator/result.h
@@ -32,13 +32,13 @@ // For now, this is just a wrapper for `ValidationResultProto`. class ValidationResult { public: - explicit ValidationResult(std::unique_ptr<ValidationResultProto> proto, - std::string manifest_store_bytes = "") + ValidationResult(std::unique_ptr<ValidationResultProto> proto, + std::string manifest_store_bytes) : proto_(std::move(proto)), manifest_store_bytes_(std::move(manifest_store_bytes)) {} - explicit ValidationResult(ValidationResultProto&& proto, - std::string manifest_store_bytes = "") + ValidationResult(ValidationResultProto&& proto, + std::string manifest_store_bytes) : proto_(std::make_unique<ValidationResultProto>(std::move(proto))), manifest_store_bytes_(std::move(manifest_store_bytes)) {}
diff --git a/validator/result_test.cc b/validator/result_test.cc index 2dd0c7c..aedcf4a 100644 --- a/validator/result_test.cc +++ b/validator/result_test.cc
@@ -36,7 +36,7 @@ TEST(ValidationResultTest, ToProto) { auto proto = std::make_unique<ValidationResultProto>(); proto->mutable_active_manifest()->set_label("test"); - ValidationResult result(std::move(proto)); + ValidationResult result(std::move(proto), ""); ValidationResultProto expected; expected.mutable_active_manifest()->set_label("test"); EXPECT_THAT(result.proto(), EqualsProto(expected));