Do not fail if reserved bits are not all zeros.

The AV1 spec instructs a decoder to ignore reserved bits. Specifically,
Section 6.2.2 says:
    obu_reserved_1bit must be set to 0. The value is ignored by a
    decoder.
Section 6.2.3 says:
    extension_header_reserved_3bits must be set to 0. The value is
    ignored by a decoder.
Section 6.7.6.1 says:
    scalability_structure_reserved_3bits must be set to zero and be
    ignored by decoders.

Update the results file for invalid-oss-fuzz-10389.ivf. The difference
between invalid-oss-fuzz-10389.ivf.res.2 and
invalid-oss-fuzz-10389.ivf.res.3 is that the expected result for the
sixth frame changed from 7 to 5.

BUG=aomedia:2811

Change-Id: I221a06d2c926353248f4e84b58b2df9ea0cf0532
diff --git a/av1/common/obu_util.c b/av1/common/obu_util.c
index 3e35d71..88c156f 100644
--- a/av1/common/obu_util.c
+++ b/av1/common/obu_util.c
@@ -74,10 +74,8 @@
     return AOM_CODEC_UNSUP_BITSTREAM;
   }
 
-  if (aom_rb_read_bit(rb) != 0) {
-    // obu_reserved_1bit must be set to 0.
-    return AOM_CODEC_CORRUPT_FRAME;
-  }
+  // obu_reserved_1bit must be set to 0. The value is ignored by a decoder.
+  aom_rb_read_bit(rb);
 
   if (header->has_extension) {
     if (bit_buffer_byte_length == 1) return AOM_CODEC_CORRUPT_FRAME;
@@ -85,10 +83,9 @@
     header->size += 1;
     header->temporal_layer_id = aom_rb_read_literal(rb, 3);
     header->spatial_layer_id = aom_rb_read_literal(rb, 2);
-    if (aom_rb_read_literal(rb, 3) != 0) {
-      // extension_header_reserved_3bits must be set to 0.
-      return AOM_CODEC_CORRUPT_FRAME;
-    }
+    // extension_header_reserved_3bits must be set to 0. The value is ignored by
+    // a decoder.
+    aom_rb_read_literal(rb, 3);
   } else {
     header->temporal_layer_id = 0;
     header->spatial_layer_id = 0;
diff --git a/av1/decoder/obu.c b/av1/decoder/obu.c
index 82ee3af..edba708 100644
--- a/av1/decoder/obu.c
+++ b/av1/decoder/obu.c
@@ -672,7 +672,9 @@
   const int spatial_layer_dimensions_present_flag = aom_rb_read_bit(rb);
   const int spatial_layer_description_present_flag = aom_rb_read_bit(rb);
   const int temporal_group_description_present_flag = aom_rb_read_bit(rb);
-  aom_rb_read_literal(rb, 3);  // reserved
+  // scalability_structure_reserved_3bits must be set to zero and be ignored by
+  // decoders.
+  aom_rb_read_literal(rb, 3);
 
   if (spatial_layer_dimensions_present_flag) {
     for (int i = 0; i <= spatial_layers_cnt_minus_1; i++) {
diff --git a/test/invalid_file_test.cc b/test/invalid_file_test.cc
index 1b48294..9e996cd 100644
--- a/test/invalid_file_test.cc
+++ b/test/invalid_file_test.cc
@@ -133,7 +133,7 @@
   { 1, "invalid-google-142530197-1.ivf", NULL },
   { 4, "invalid-oss-fuzz-9463.ivf", "invalid-oss-fuzz-9463.ivf.res.2" },
   { 1, "invalid-oss-fuzz-9720.ivf", NULL },
-  { 1, "invalid-oss-fuzz-10389.ivf", "invalid-oss-fuzz-10389.ivf.res.2" },
+  { 1, "invalid-oss-fuzz-10389.ivf", "invalid-oss-fuzz-10389.ivf.res.3" },
   { 1, "invalid-oss-fuzz-11523.ivf", "invalid-oss-fuzz-11523.ivf.res.2" },
   { 4, "invalid-oss-fuzz-15363.ivf", NULL },
   { 1, "invalid-oss-fuzz-16437.ivf", "invalid-oss-fuzz-16437.ivf.res.2" },
diff --git a/test/test-data.sha1 b/test/test-data.sha1
index b421211..96d371a 100644
--- a/test/test-data.sha1
+++ b/test/test-data.sha1
@@ -15,7 +15,7 @@
 91a5bedeb4832c1c2900736cc0f644bb63971bbc *invalid-oss-fuzz-10227.ivf
 b055f06b9a95aaa5697fa26497b592a47843a7c8 *invalid-oss-fuzz-10227.ivf.res
 b2d0a29a65879436bf483d04865faca7d11cc2ee *invalid-oss-fuzz-10389.ivf
-e5fe0e8984c42d53d4ff734c3fbfd57d5c5c25cf *invalid-oss-fuzz-10389.ivf.res.2
+14247bdb2adc5505b28c3ffc707dcb29816bcb76 *invalid-oss-fuzz-10389.ivf.res.3
 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 8fcaa33..bff21f7 100644
--- a/test/test_data_util.cmake
+++ b/test/test_data_util.cmake
@@ -534,7 +534,7 @@
               "invalid-oss-fuzz-10227.ivf"
               "invalid-oss-fuzz-10227.ivf.res"
               "invalid-oss-fuzz-10389.ivf"
-              "invalid-oss-fuzz-10389.ivf.res.2"
+              "invalid-oss-fuzz-10389.ivf.res.3"
               "invalid-oss-fuzz-10555.ivf"
               "invalid-oss-fuzz-10555.ivf.res"
               "invalid-oss-fuzz-10705.ivf"