av1/decoder/obu.c: don't fail on undefined levels The AV1 spec is silent on how a decoder should handle a level that is not yet defined. A reasonable behavior is to allow such a level without checking the level constraints (because they are not defined). Bug: 471949427 Change-Id: I5022d283f79ba8455dccbf49749b160902c111db
diff --git a/av1/decoder/obu.c b/av1/decoder/obu.c index 2ee124b..815d805 100644 --- a/av1/decoder/obu.c +++ b/av1/decoder/obu.c
@@ -79,14 +79,6 @@ static uint32_t read_temporal_delimiter_obu(void) { return 0; } -// Returns a boolean that indicates success. -static int read_bitstream_level(AV1_LEVEL *seq_level_idx, - struct aom_read_bit_buffer *rb) { - *seq_level_idx = aom_rb_read_literal(rb, LEVEL_BITS); - if (!is_valid_seq_level_idx(*seq_level_idx)) return 0; - return 1; -} - // Returns whether two sequence headers are consistent with each other. // Note that the 'op_params' field is not compared per Section 7.5 in the spec: // Within a particular coded video sequence, the contents of @@ -137,11 +129,7 @@ seq_params->operating_points_cnt_minus_1 = 0; seq_params->operating_point_idc[0] = 0; seq_params->has_nonzero_operating_point_idc = false; - if (!read_bitstream_level(&seq_params->seq_level_idx[0], rb)) { - aom_internal_error(&pbi->error, AOM_CODEC_UNSUP_BITSTREAM, - "Value %d of seq_level_idx[%d] is not yet defined", - seq_params->seq_level_idx[0], 0); - } + seq_params->seq_level_idx[0] = aom_rb_read_literal(rb, LEVEL_BITS); seq_params->tier[0] = 0; seq_params->op_params[0].decoder_model_param_present_flag = 0; seq_params->op_params[0].display_model_param_present_flag = 0; @@ -165,11 +153,7 @@ aom_rb_read_literal(rb, OP_POINTS_IDC_BITS); if (seq_params->operating_point_idc[i] != 0) seq_params->has_nonzero_operating_point_idc = true; - if (!read_bitstream_level(&seq_params->seq_level_idx[i], rb)) { - aom_internal_error(&pbi->error, AOM_CODEC_UNSUP_BITSTREAM, - "Value %d of seq_level_idx[%d] is not yet defined", - seq_params->seq_level_idx[i], i); - } + seq_params->seq_level_idx[i] = aom_rb_read_literal(rb, LEVEL_BITS); // This is the seq_level_idx[i] > 7 check in the spec. seq_level_idx 7 // is equivalent to level 3.3. if (seq_params->seq_level_idx[i] >= SEQ_LEVEL_4_0)
diff --git a/test/invalid_file_test.cc b/test/invalid_file_test.cc index 9a052b4..4cbf29e 100644 --- a/test/invalid_file_test.cc +++ b/test/invalid_file_test.cc
@@ -13,6 +13,7 @@ #include <ostream> #include <string> +#include "config/aom_config.h" #include "gtest/gtest.h" #include "test/codec_factory.h" #include "test/ivf_video_source.h" @@ -131,7 +132,7 @@ { 1, "invalid-google-142530197-1.ivf", nullptr }, { 4, "invalid-oss-fuzz-9463.ivf", "invalid-oss-fuzz-9463.ivf.res.2" }, { 1, "invalid-oss-fuzz-9720.ivf", nullptr }, - { 1, "invalid-oss-fuzz-10389.ivf", "invalid-oss-fuzz-10389.ivf.res.4" }, + { 1, "invalid-oss-fuzz-10389.ivf", "invalid-oss-fuzz-10389.ivf.res.5" }, #if !defined(CHROMIUM) && !CONFIG_SIZE_LIMIT || \ (CONFIG_SIZE_LIMIT && DECODE_WIDTH_LIMIT >= 5120 && \ DECODE_HEIGHT_LIMIT >= 180) @@ -151,11 +152,7 @@ { 1, "invalid-oss-fuzz-10227.ivf", nullptr }, { 4, "invalid-oss-fuzz-10555.ivf", nullptr }, { 1, "invalid-oss-fuzz-10705.ivf", nullptr }, -#if CONFIG_CWG_C013 { 1, "invalid-oss-fuzz-10723.ivf", "invalid-oss-fuzz-10723.ivf.res.3" }, -#else - { 1, "invalid-oss-fuzz-10723.ivf", "invalid-oss-fuzz-10723.ivf.res.2" }, -#endif { 1, "invalid-oss-fuzz-10779.ivf", nullptr }, { 1, "invalid-oss-fuzz-11477.ivf", nullptr }, { 1, "invalid-oss-fuzz-11479.ivf", "invalid-oss-fuzz-11479.ivf.res.2" },
diff --git a/test/test-data.sha1 b/test/test-data.sha1 index 88ada14..a5bd6e2 100644 --- a/test/test-data.sha1 +++ b/test/test-data.sha1
@@ -16,7 +16,7 @@ 91a5bedeb4832c1c2900736cc0f644bb63971bbc *invalid-oss-fuzz-10227.ivf b055f06b9a95aaa5697fa26497b592a47843a7c8 *invalid-oss-fuzz-10227.ivf.res b2d0a29a65879436bf483d04865faca7d11cc2ee *invalid-oss-fuzz-10389.ivf -f4ce175af1d871ed1603c8936f6b78e968f93c85 *invalid-oss-fuzz-10389.ivf.res.4 +ddd9f38cd81a88e53ef71879adbaa40bac02e634 *invalid-oss-fuzz-10389.ivf.res.5 11df8e9a068669c678097d460b63609d3da73828 *invalid-oss-fuzz-10555.ivf b055f06b9a95aaa5697fa26497b592a47843a7c8 *invalid-oss-fuzz-10555.ivf.res cf5945085fe85456a1f74bf4cc7998b88b3f4b62 *invalid-oss-fuzz-10705.ivf
diff --git a/test/test_data_util.cmake b/test/test_data_util.cmake index 76e77a5..8ae6b25 100644 --- a/test/test_data_util.cmake +++ b/test/test_data_util.cmake
@@ -552,7 +552,7 @@ "invalid-oss-fuzz-10227.ivf" "invalid-oss-fuzz-10227.ivf.res" "invalid-oss-fuzz-10389.ivf" - "invalid-oss-fuzz-10389.ivf.res.4" + "invalid-oss-fuzz-10389.ivf.res.5" "invalid-oss-fuzz-10555.ivf" "invalid-oss-fuzz-10555.ivf.res" "invalid-oss-fuzz-10705.ivf"