From d9e13fade0ac13b8c295d4a1ddb94328a0fdd1e3 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 25 May 2021 10:45:49 -0400 Subject: [PATCH] add table area validation --- psoutils/src/quest/dat.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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)?;