Skip to content

Commit

Permalink
Actually build the RangeDetails at the right time
Browse files Browse the repository at this point in the history
  • Loading branch information
s1341 committed Jan 4, 2024
1 parent 9bfa5f1 commit 75411cf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions frida-gum/src/range_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<'a> FileMapping<'a> {

struct SaveRangeDetailsByAddressContext {
address: u64,
details: *const gum_sys::GumRangeDetails,
details: Option<RangeDetails>,

Check failure on line 85 in frida-gum/src/range_details.rs

View workflow job for this annotation

GitHub Actions / Check no_std

missing lifetime specifier

Check failure on line 85 in frida-gum/src/range_details.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

missing lifetime specifier

Check failure on line 85 in frida-gum/src/range_details.rs

View workflow job for this annotation

GitHub Actions / Check (x86_64)

missing lifetime specifier

Check failure on line 85 in frida-gum/src/range_details.rs

View workflow job for this annotation

GitHub Actions / Check no_std

missing lifetime specifier
}

unsafe extern "C" fn save_range_details_by_address(
Expand All @@ -94,7 +94,7 @@ unsafe extern "C" fn save_range_details_by_address(
let start = (*range).base_address as u64;
let end = start + (*range).size as u64;
if start <= context.address && context.address < end {
context.details = details;
context.details = Some(RangeDetails::from_raw(details));
return 0;
}

Expand Down Expand Up @@ -137,7 +137,7 @@ impl<'a> RangeDetails<'a> {
pub fn with_address(address: u64) -> Option<RangeDetails<'a>> {
let mut context = SaveRangeDetailsByAddressContext {
address,
details: core::ptr::null_mut(),
details: None,
};
unsafe {
gum_sys::gum_process_enumerate_ranges(
Expand All @@ -147,11 +147,7 @@ impl<'a> RangeDetails<'a> {
);
}

if !context.details.is_null() {
Some(RangeDetails::from_raw(context.details))
} else {
None
}
context.details
}

/// Enumerate all ranges which match the given [`PageProtection`], calling the callback
Expand Down

0 comments on commit 75411cf

Please sign in to comment.