diff --git a/psoutils/src/quest/dat.rs b/psoutils/src/quest/dat.rs index c582dc1..13c18fd 100644 --- a/psoutils/src/quest/dat.rs +++ b/psoutils/src/quest/dat.rs @@ -218,6 +218,14 @@ impl QuestDat { otherwise => otherwise, }; + // note: both episode area lists are the same size + if area >= QUEST_DAT_AREAS[0].len() as u32 { + return Err(QuestDatError::DataFormatError(format!( + "Invalid area {} for table at index {}", + area, index + ))); + } + let mut body_bytes = vec![0u8; table_body_size as usize]; reader.read_exact(&mut body_bytes)?;