diff --git a/crates/raw/src/opcode_params.rs b/crates/raw/src/opcode_params.rs index 0aef54d09..4f2433269 100644 --- a/crates/raw/src/opcode_params.rs +++ b/crates/raw/src/opcode_params.rs @@ -254,7 +254,11 @@ pub fn parse(id: u32, bytes: &[u8], context: Context) -> Result, Pars _ => { let n = r.count(4)?; let vals = (0..n).map(|_| r.f32()).collect::, _>>()?; - let need = if matches!(id, 10 | 12) { area.rows().count() } else { area.cols().count() }; + let need = if matches!(id, 10 | 12) { + area.bottom.saturating_sub(area.top).div_ceil(area.row_pitch) + } else { + area.right.saturating_sub(area.left).div_ceil(area.col_pitch) + }; if vals.len() < need { return Err(ParseError::Malformed("opcode with fewer values than rows or columns")); }