File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -347,16 +347,16 @@ impl<'a> RelocationData<'a> {
347347 dd. virtual_address
348348 ) )
349349 } ) ?;
350+ // To allow parsing the rest, we will not raise a malformation error
351+ // when we found that the base relocation directory not lies in the binary.
352+ // If that's the case, we store an empty `bytes`, which implies no-op
353+ // when `blocks` is called.
354+ if bytes. len ( ) < offset {
355+ return Ok ( Self { bytes : & [ ] } ) ;
356+ }
350357 let bytes = bytes[ offset..]
351- . pread :: < & [ u8 ] > ( dd. size as usize )
352- . map_err ( |_| {
353- error:: Error :: Malformed ( format ! (
354- "base reloc offset {:#x} and size {:#x} exceeds the bounds of the bytes size {:#x}" ,
355- offset,
356- dd. size,
357- bytes. len( )
358- ) )
359- } ) ?;
358+ . pread_with :: < & [ u8 ] > ( 0 , dd. size as usize )
359+ . unwrap_or_default ( ) ;
360360
361361 Ok ( Self { bytes } )
362362 }
You can’t perform that action at this time.
0 commit comments