add table area validation

This commit is contained in:
Gered 2021-05-25 10:45:49 -04:00
parent d27d9ad072
commit d9e13fade0

View file

@ -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)?;