From bf62db450714d8aa1ada8475208f17cbe38c8179 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 25 May 2021 10:51:45 -0400 Subject: [PATCH] add extra validation for .bin function_offset_table_offset --- psoutils/src/quest/bin.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psoutils/src/quest/bin.rs b/psoutils/src/quest/bin.rs index 15319a1..c7eb9e2 100644 --- a/psoutils/src/quest/bin.rs +++ b/psoutils/src/quest/bin.rs @@ -110,6 +110,12 @@ impl QuestBin { } let function_offset_table_offset = reader.read_u32::()?; + if function_offset_table_offset <= object_code_offset { + return Err(QuestBinError::DataFormatError(format!( + "function_offset_table_offset points to a location that occurs before the object_code" + ))); + } + let bin_size = reader.read_u32::()?; let _xfffffff = reader.read_u32::()?; // always expected to be 0xffffffff let is_download = reader.read_u8()?;