forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'simplify/b8' into simplify/w1a

Browse files at this commit

cb77c393243a4c6951d61bc2933957b67d0fd371Ahmet Kaan GümüşParent: 41c7266892fabd
crates/ec-av1-syntax/src/frame.rsmodified+12 -0
@@ -793,6 +793,12 @@ pub(crate) fn parse_uncompressed_header(
793 h.display_frame_id = r.read_bits(id_len)?;793 h.display_frame_id = r.read_bits(id_len)?;
794 }794 }
795 let slot = state.refs[h.frame_to_show_map_idx as usize];795 let slot = state.refs[h.frame_to_show_map_idx as usize];
796+ if !slot.valid {
797+ return Err(Error::corrupt(format!(
798+ "AV1 show_existing_frame shows empty slot {}",
799+ h.frame_to_show_map_idx
800+ )));
801+ }
796 h.frame_type = slot.frame_type;802 h.frame_type = slot.frame_type;
797 h.frame_is_intra = matches!(h.frame_type, FrameType::Key | FrameType::IntraOnly);803 h.frame_is_intra = matches!(h.frame_type, FrameType::Key | FrameType::IntraOnly);
798 h.show_frame = true;804 h.show_frame = true;
@@ -950,6 +956,12 @@ pub(crate) fn parse_uncompressed_header(
950 if !h.frame_refs_short_signaling {956 if !h.frame_refs_short_signaling {
951 h.ref_frame_idx[i] = r.read_bits(3)? as u8;957 h.ref_frame_idx[i] = r.read_bits(3)? as u8;
952 }958 }
959+ if !state.refs[h.ref_frame_idx[i] as usize].valid {
960+ return Err(Error::corrupt(format!(
961+ "AV1 inter frame references empty slot {}",
962+ h.ref_frame_idx[i]
963+ )));
964+ }
953 if seq.frame_id_numbers_present_flag {965 if seq.frame_id_numbers_present_flag {
954 h.delta_frame_id[i] = r.read_bits(seq.delta_frame_id_length)? + 1;966 h.delta_frame_id[i] = r.read_bits(seq.delta_frame_id_length)? + 1;
955 }967 }
crates/ec-av1-syntax/src/lib.rsmodified+5 -1
@@ -313,7 +313,11 @@ impl Av1Parser {
313 } else {313 } else {
314 apply_refresh(&mut self.state, &h, seq.color_config.bit_depth);314 apply_refresh(&mut self.state, &h, seq.color_config.bit_depth);
315 }315 }
316- self.pending = Some(h.clone());316+ self.pending = if h.show_existing_frame {
317+ None
318+ } else {
319+ Some(h.clone())
320+ };
317 }321 }
318 Ok(h)322 Ok(h)
319 }323 }