From 867298ae73a4bbdbf5d44cce994aeb3c36d00dbe Mon Sep 17 00:00:00 2001 From: Jan Michael Auer Date: Tue, 5 May 2020 16:22:22 +0200 Subject: [PATCH] Fix invalid offset for unwind exception handler data --- src/pe/exception.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pe/exception.rs b/src/pe/exception.rs index 069bf2aab..8f853a24c 100644 --- a/src/pe/exception.rs +++ b/src/pe/exception.rs @@ -587,13 +587,13 @@ impl<'a> UnwindInfo<'a> { // whenever flags UNW_FLAG_EHANDLER or UNW_FLAG_UHANDLER are set. The language-specific // handler is called as part of the search for an exception handler or as part of an unwind. } else if flags & (UNW_FLAG_EHANDLER | UNW_FLAG_UHANDLER) != 0 { - let offset = bytes.gread_with::(&mut offset, scroll::LE)? as usize; + let address = bytes.gread_with::(&mut offset, scroll::LE)?; let data = &bytes[offset..]; handler = Some(if flags & UNW_FLAG_EHANDLER != 0 { - UnwindHandler::ExceptionHandler(offset as u32, data) + UnwindHandler::ExceptionHandler(address, data) } else { - UnwindHandler::TerminationHandler(offset as u32, data) + UnwindHandler::TerminationHandler(address, data) }); }