Skip to content

Commit

Permalink
Run clippy, fixes a bug where section.view_size returned data_size
Browse files Browse the repository at this point in the history
Guessing that the bug has caused no issues due to windows rounding the size
to a page anyway in the API calls?
  • Loading branch information
neivv committed Jun 9, 2024
1 parent 2faebd1 commit e362c21
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ macro_rules! log {
}};
}

thread_local!(static LOG_CALLBACK: RefCell<Option<LogCallback>> = RefCell::new(None));
thread_local!(static LOG_CALLBACK: RefCell<Option<LogCallback>> = const { RefCell::new(None) });

struct LogCallback {
channel: Channel,
Expand Down Expand Up @@ -200,7 +200,7 @@ impl PeImage for IMAGE_NT_HEADERS32 {
self.Signature == IMAGE_NT_SIGNATURE
}
fn machine(&self) -> u16 {
self.FileHeader.Machine as u16
self.FileHeader.Machine
}
}

Expand All @@ -224,7 +224,7 @@ impl PeImage for IMAGE_NT_HEADERS64 {
self.Signature == IMAGE_NT_SIGNATURE
}
fn machine(&self) -> u16 {
self.FileHeader.Machine as u16
self.FileHeader.Machine
}
}

Expand Down Expand Up @@ -314,7 +314,7 @@ impl DynamicCodeSection {
}

pub fn view_size(&self) -> usize {
self.data_size
self.view_size
}
}

Expand Down Expand Up @@ -651,7 +651,10 @@ impl Process {
fn read_image_header<T: MemRegion>(&self, region: &T) -> Result<Option<Box<dyn PeImage>>> {
// Read the DOS header
let mut dos_hdr: IMAGE_DOS_HEADER = unsafe { mem::zeroed() };
if let Err(_) = self.read_struct(region.addr(), ptr::addr_of_mut!(dos_hdr)) {
if self
.read_struct(region.addr(), ptr::addr_of_mut!(dos_hdr))
.is_err()
{
return Ok(None);
}
if dos_hdr.e_magic != IMAGE_DOS_SIGNATURE {
Expand Down

0 comments on commit e362c21

Please sign in to comment.