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