Skip to content

Commit 3f62df7

Browse files
committed
Rust 2024 Edition
Signed-off-by: Isaac Marovitz <[email protected]>
1 parent e1d315b commit 3f62df7

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pe-parser"
33
version = "0.7.0"
4-
edition = "2021"
4+
edition = "2024"
55
license = "MIT"
66
authors = ["Isaac Marovitz <[email protected]>"]
77
description = "A blazing fast PE Parser with pretty print"

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "pe-parser-fuzz"
33
version = "0.0.0"
44
publish = false
5-
edition = "2021"
5+
edition = "2024"
66

77
[package.metadata]
88
cargo-fuzz = true

src/main.rs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,44 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3030
.help("Print section table"))
3131
.get_matches();
3232

33-
if let Some(file) = matches.get_one::<String>("file") {
34-
const VERSION: &str = env!("CARGO_PKG_VERSION");
35-
println!("PE Parser - Version {}", VERSION);
36-
println!("=========================\n");
37-
38-
let binary = fs::read(file)
39-
.expect("Failed to read file");
40-
41-
let pe = parse_portable_executable(binary.as_slice())
42-
.expect("Failed to parse Portable Executable!");
33+
match matches.get_one::<String>("file") {
34+
Some(file) => {
35+
const VERSION: &str = env!("CARGO_PKG_VERSION");
36+
println!("PE Parser - Version {}", VERSION);
37+
println!("=========================\n");
4338

44-
if matches.get_flag("all") {
45-
print!("{}", pe);
46-
} else {
47-
if matches.get_flag("coff") {
48-
println!("{}", pe.coff);
49-
}
50-
51-
if matches.get_flag("optional") {
52-
if let Some(optional) = pe.optional_header_32 {
53-
println!("{}", optional);
39+
let binary = fs::read(file)
40+
.expect("Failed to read file");
41+
42+
let pe = parse_portable_executable(binary.as_slice())
43+
.expect("Failed to parse Portable Executable!");
44+
45+
if matches.get_flag("all") {
46+
print!("{}", pe);
47+
} else {
48+
if matches.get_flag("coff") {
49+
println!("{}", pe.coff);
5450
}
55-
56-
if let Some(optional) = pe.optional_header_64 {
57-
println!("{}", optional);
51+
52+
if matches.get_flag("optional") {
53+
if let Some(optional) = pe.optional_header_32 {
54+
println!("{}", optional);
55+
}
56+
57+
if let Some(optional) = pe.optional_header_64 {
58+
println!("{}", optional);
59+
}
5860
}
59-
}
60-
61-
if matches.get_flag("section") {
62-
for section in pe.section_table.iter() {
63-
println!("{}", section);
61+
62+
if matches.get_flag("section") {
63+
for section in pe.section_table.iter() {
64+
println!("{}", section);
65+
}
6466
}
6567
}
68+
} _ => {
69+
println!("No PE file passed to parse!");
6670
}
67-
} else {
68-
println!("No PE file passed to parse!");
6971
};
7072

7173
Ok(())

0 commit comments

Comments
 (0)