@@ -57,7 +57,7 @@ pub struct PE<'a> {
57
57
pub debug_data : Option < debug:: DebugData < ' a > > ,
58
58
/// Exception handling and stack unwind information, if any, contained in the PE header
59
59
pub exception_data : Option < exception:: ExceptionData < ' a > > ,
60
- pub section_table : & ' a [ u8 ]
60
+ pub section_table : & ' a [ u8 ] ,
61
61
}
62
62
63
63
impl < ' a > PE < ' a > {
@@ -70,15 +70,16 @@ impl<'a> PE<'a> {
70
70
+ header:: SIZEOF_COFF_HEADER
71
71
+ header. coff_header . size_of_optional_header as usize ) ;
72
72
73
- let min_size = * offset + header. coff_header . number_of_sections as usize * header:: SIZEOF_IMAGE_SECTION_HEADER ;
73
+ let min_size = * offset
74
+ + header. coff_header . number_of_sections as usize * header:: SIZEOF_IMAGE_SECTION_HEADER ;
74
75
75
76
if bytes. len ( ) < min_size {
76
77
// The section table contains more entries than the binary can provide given the size
77
- return Err (
78
- error :: Error :: Malformed (
79
- format ! ( "Corrupted PE: Expected at least {:#X} bytes but got {:#X}" , min_size, bytes . len ( ) )
80
- )
81
- )
78
+ return Err ( error :: Error :: Malformed ( format ! (
79
+ "Corrupted PE: Expected at least {:#X} bytes but got {:#X}" ,
80
+ min_size,
81
+ bytes . len ( )
82
+ ) ) ) ;
82
83
}
83
84
84
85
let section_table = & bytes[ * offset..min_size] ;
@@ -189,7 +190,7 @@ impl<'a> PE<'a> {
189
190
libraries,
190
191
debug_data,
191
192
exception_data,
192
- section_table
193
+ section_table,
193
194
} )
194
195
}
195
196
}
0 commit comments