@@ -60,7 +60,7 @@ impl<'a> Loader<'a> {
6060 Err ( _) => return Err ( Error :: FileError ) ,
6161 }
6262
63- let dos_region = MemoryRegion :: from_slice ( & data) ;
63+ let dos_region = MemoryRegion :: from_bytes ( & mut data) ;
6464
6565 // 'MZ' magic
6666 if dos_region. read_u16 ( 0 ) != 0x5a4d {
@@ -74,7 +74,7 @@ impl<'a> Loader<'a> {
7474 return Err ( Error :: InvalidExecutable ) ;
7575 }
7676
77- let pe_region = MemoryRegion :: from_slice ( & data[ pe_header_offset as usize ..] ) ;
77+ let pe_region = MemoryRegion :: from_bytes ( & mut data[ pe_header_offset as usize ..] ) ;
7878
7979 // The Microsoft specification uses offsets relative to the COFF area
8080 // which is 4 after the signature (so all offsets are +4 relative to the spec)
@@ -91,7 +91,8 @@ impl<'a> Loader<'a> {
9191 self . num_sections = pe_region. read_u16 ( 6 ) ;
9292
9393 let optional_header_size = pe_region. read_u16 ( 20 ) ;
94- let optional_region = MemoryRegion :: from_slice ( & data[ ( 24 + pe_header_offset) as usize ..] ) ;
94+ let optional_region =
95+ MemoryRegion :: from_bytes ( & mut data[ ( 24 + pe_header_offset) as usize ..] ) ;
9596
9697 // Only support x86-64 EFI
9798 if optional_region. read_u16 ( 0 ) != 0x20b {
@@ -177,7 +178,7 @@ impl<'a> Loader<'a> {
177178 let l: & mut [ u8 ] = loaded_region
178179 . as_mut_slice ( u64:: from ( section. virt_address ) , u64:: from ( section_size) ) ;
179180
180- let reloc_region = MemoryRegion :: from_slice ( l) ;
181+ let reloc_region = MemoryRegion :: from_bytes ( l) ;
181182
182183 let mut section_bytes_remaining = section_size;
183184 let mut offset = 0 ;
0 commit comments