B8: AV1 show_existing_frame and inter frames must name valid ref slots, else Corrupt (spec 6.8.2 conformance; empty slot previously decoded garbage)
Browse files at this commit990c0b546e1d301cea06ca079771c1470f81b4c5Parent: 22f0f3f1 changed file +12 -0
crates/ec-av1-syntax/src/frame.rsmodified+12 -0
| @@ -793,6 +793,12 @@ pub(crate) fn parse_uncompressed_header( | ||
| 793 | 793 | h.display_frame_id = r.read_bits(id_len)?; |
| 794 | 794 | } |
| 795 | 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 | 802 | h.frame_type = slot.frame_type; |
| 797 | 803 | h.frame_is_intra = matches!(h.frame_type, FrameType::Key | FrameType::IntraOnly); |
| 798 | 804 | h.show_frame = true; |
| @@ -950,6 +956,12 @@ pub(crate) fn parse_uncompressed_header( | ||
| 950 | 956 | if !h.frame_refs_short_signaling { |
| 951 | 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 | 965 | if seq.frame_id_numbers_present_flag { |
| 954 | 966 | h.delta_frame_id[i] = r.read_bits(seq.delta_frame_id_length)? + 1; |
| 955 | 967 | } |