Bug 1716518 - Upgrade goblin to v0.1.3. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D117792
This commit is contained in:
Mike Hommey 2021-06-15 21:24:43 +00:00
parent f7192b4538
commit c1feebb064
29 changed files with 238 additions and 235 deletions

4
Cargo.lock generated
View File

@ -2147,9 +2147,9 @@ dependencies = [
[[package]]
name = "goblin"
version = "0.1.2"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88a79ef1f0dad46fd78075b6f80f92d97710eddf87b3e18a15a66761e8942672"
checksum = "3081214398d39e4bd7f2c1975f0488ed04614ffdd976c6fc7a0708278552c0da"
dependencies = [
"log",
"plain",

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,15 @@ Before 1.0, this project does not adhere to [Semantic Versioning](http://semver.
Goblin is now 0.1, which means we will try our best to ease breaking changes. Tracking issue is here: https://github.com/m4b/goblin/issues/97
## [0.1.3] - 2019-12-28
### Removed
- alloc feature, stabilized in 1.36 @philipc https://github.com/m4b/goblin/pull/196
### Added
elf: support empty PT_DYNAMIC references, @jan-auer https://github.com/m4b/goblin/pull/193
elf: move various elf::Sym impls out of alloc gate, @lzutao https://github.com/m4b/goblin/pull/198
### Fixed
elf: parsing 0 section header had regression introduced in 779d0ce, fixed by @philipc https://github.com/m4b/goblin/pull/200
## [0.1.2] - 2019-12-02
### Fixed
mach: don't return data for zerofill sections, @philipc https://github.com/m4b/goblin/pull/195

2
third_party/rust/goblin/Cargo.lock generated vendored
View File

@ -7,7 +7,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "goblin"
version = "0.1.2"
version = "0.1.3"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "goblin"
version = "0.1.2"
version = "0.1.3"
authors = ["m4b <m4b.github.io@gmail.com>", "seu <seu@panopticon.re>", "Will Glynn <will@willglynn.com>", "Philip Craig <philipjcraig@gmail.com>"]
include = ["src/**/*", "Cargo.toml", "CHANGELOG.md", "LICENSE", "README.md", "etc/*", "examples/*", "tests/*", "fuzz/**/*"]
description = "An impish, cross-platform, ELF, Mach-o, and PE binary parsing and loading crate"

View File

@ -17,7 +17,7 @@ https://docs.rs/goblin/
### Usage
Goblin requires `rustc` 1.31.1.
Goblin requires `rustc` 1.36.0.
Add to your `Cargo.toml`

View File

@ -12,8 +12,8 @@ use crate::strtab;
use crate::error::{Result, Error};
use core::usize;
use crate::alloc::collections::btree_map::BTreeMap;
use crate::alloc::vec::Vec;
use alloc::collections::btree_map::BTreeMap;
use alloc::vec::Vec;
pub const SIZEOF_MAGIC: usize = 8;
/// The magic number of a Unix Archive

View File

@ -282,7 +282,7 @@ if_alloc! {
use core::result;
use crate::container::{Ctx, Container};
use crate::strtab::Strtab;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
#[derive(Default, PartialEq, Clone)]
pub struct Dyn {
@ -372,10 +372,14 @@ if_alloc! {
let offset = phdr.p_offset as usize;
let filesz = phdr.p_filesz as usize;
// Ensure offset and filesz are valid.
let bytes = bytes
.pread_with::<&[u8]>(offset, filesz)
.map_err(|_| crate::error::Error::Malformed(format!("Invalid PT_DYNAMIC size (offset {:#x}, filesz {:#x})",
offset, filesz)))?;
let bytes = if filesz > 0 {
bytes
.pread_with::<&[u8]>(offset, filesz)
.map_err(|_| crate::error::Error::Malformed(format!("Invalid PT_DYNAMIC size (offset {:#x}, filesz {:#x})",
offset, filesz)))?
} else {
&[]
};
let size = Dyn::size_with(&ctx);
let count = filesz / size;
let mut dyns = Vec::with_capacity(count);
@ -430,7 +434,7 @@ macro_rules! elf_dyn_std_impl {
if_alloc! {
use core::fmt;
use core::slice;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use crate::elf::program_header::{PT_DYNAMIC};
use crate::strtab::Strtab;

View File

@ -156,7 +156,7 @@ if_alloc! {
use scroll::{ctx, Endian};
use core::fmt;
use crate::container::{Ctx, Container};
use crate::alloc::string::ToString;
use alloc::string::ToString;
#[derive(Copy, Clone, PartialEq)]
/// An ELF header
@ -520,7 +520,7 @@ macro_rules! elf_header_test {
use crate::elf::header::Header as ElfHeader;
use super::*;
use crate::container::{Ctx, Container};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
#[test]
fn size_of() {
assert_eq!(::std::mem::size_of::<Header>(), SIZEOF_EHDR);

View File

@ -66,7 +66,7 @@ if_sylvan! {
use crate::strtab::Strtab;
use crate::error;
use crate::container::{Container, Ctx};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use core::cmp;
pub type Header = header::Header;

View File

@ -74,7 +74,7 @@ if_alloc! {
use crate::error;
use crate::container;
use scroll::ctx;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
/// An iterator over ELF binary notes in a note section or segment
pub struct NoteDataIterator<'a> {

View File

@ -83,7 +83,7 @@ if_alloc! {
use core::result;
use core::ops::Range;
use crate::container::{Ctx, Container};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
#[derive(Default, PartialEq, Clone)]
/// A unified ProgramHeader - convertable to and from 32-bit and 64-bit variants

View File

@ -283,7 +283,7 @@ if_alloc! {
use core::result;
use crate::container::{Ctx, Container};
#[cfg(feature = "endian_fd")]
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
#[derive(Clone, Copy, PartialEq, Default)]
/// A unified ELF relocation structure

View File

@ -276,7 +276,7 @@ macro_rules! elf_section_header_std_impl { ($size:ty) => {
use crate::elf::section_header::SectionHeader as ElfSectionHeader;
use plain::Plain;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
if_std! {
use crate::error::Result;
@ -377,7 +377,7 @@ if_alloc! {
use crate::container::{Container, Ctx};
#[cfg(feature = "endian_fd")]
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
#[derive(Default, PartialEq, Clone)]
/// A unified SectionHeader - convertable to and from 32-bit and 64-bit variants
@ -435,16 +435,22 @@ if_alloc! {
}
/// Parse `count` section headers from `bytes` at `offset`, using the given `ctx`
#[cfg(feature = "endian_fd")]
pub fn parse(bytes: &[u8], mut offset: usize, count: usize, ctx: Ctx) -> error::Result<Vec<SectionHeader>> {
pub fn parse(bytes: &[u8], mut offset: usize, mut count: usize, ctx: Ctx) -> error::Result<Vec<SectionHeader>> {
use scroll::Pread;
let mut section_headers = Vec::with_capacity(count);
let mut nsection_headers = count;
// Zero offset means no section headers, not even the null section header.
if offset == 0 {
return Ok(Vec::new());
}
let empty_sh = bytes.gread_with::<SectionHeader>(&mut offset, ctx)?;
if count == 0 as usize {
nsection_headers = empty_sh.sh_size as usize;
// Zero count means either no section headers if offset is also zero (checked
// above), or the number of section headers overflows SHN_LORESERVE, in which
// case the count is stored in the sh_size field of the null section header.
count = empty_sh.sh_size as usize;
}
let mut section_headers = Vec::with_capacity(count);
section_headers.push(empty_sh);
for _ in 1..nsection_headers {
for _ in 1..count {
let shdr = bytes.gread_with(&mut offset, ctx)?;
section_headers.push(shdr);
}

View File

@ -163,84 +163,81 @@ macro_rules! elf_sym_std_impl {
}
}
if_alloc! {
use crate::elf::sym::Sym as ElfSym;
use crate::elf::sym::Sym as ElfSym;
use core::fmt;
use core::slice;
if_std! {
use crate::error::Result;
use std::fs::File;
use std::io::{Read, Seek};
use std::io::SeekFrom::Start;
}
impl Sym {
/// Checks whether this `Sym` has `STB_GLOBAL`/`STB_WEAK` bind and a `st_value` of 0
#[inline]
pub fn is_import(&self) -> bool {
let bind = self.st_info >> 4;
(bind == STB_GLOBAL || bind == STB_WEAK) && self.st_value == 0
}
/// Checks whether this `Sym` has type `STT_FUNC`
#[inline]
pub fn is_function(&self) -> bool {
st_type(self.st_info) == STT_FUNC
}
}
impl From<Sym> for ElfSym {
#[inline]
fn from(sym: Sym) -> Self {
ElfSym {
st_name: sym.st_name as usize,
st_info: sym.st_info,
st_other: sym.st_other,
st_shndx: sym.st_shndx as usize,
st_value: u64::from(sym.st_value),
st_size: u64::from(sym.st_size),
}
}
}
impl From<ElfSym> for Sym {
#[inline]
fn from(sym: ElfSym) -> Self {
Sym {
st_name: sym.st_name as u32,
st_info: sym.st_info,
st_other: sym.st_other,
st_shndx: sym.st_shndx as u16,
st_value: sym.st_value as $size,
st_size: sym.st_size as $size,
}
}
}
impl fmt::Debug for Sym {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let bind = st_bind(self.st_info);
let typ = st_type(self.st_info);
let vis = st_visibility(self.st_other);
f.debug_struct("Sym")
.field("st_name", &self.st_name)
.field("st_value", &format_args!("{:x}", self.st_value))
.field("st_size", &self.st_size)
.field("st_info", &format_args!("{:x} {} {}", self.st_info, bind_to_str(bind), type_to_str(typ)))
.field("st_other", &format_args!("{} {}", self.st_other, visibility_to_str(vis)))
.field("st_shndx", &self.st_shndx)
.finish()
}
}
use core::fmt;
use core::slice;
impl Sym {
/// Checks whether this `Sym` has `STB_GLOBAL`/`STB_WEAK` bind and a `st_value` of 0
#[inline]
pub unsafe fn from_raw<'a>(symp: *const Sym, count: usize) -> &'a [Sym] {
slice::from_raw_parts(symp, count)
pub fn is_import(&self) -> bool {
let bind = self.st_info >> 4;
(bind == STB_GLOBAL || bind == STB_WEAK) && self.st_value == 0
}
/// Checks whether this `Sym` has type `STT_FUNC`
#[inline]
pub fn is_function(&self) -> bool {
st_type(self.st_info) == STT_FUNC
}
}
impl From<Sym> for ElfSym {
#[inline]
fn from(sym: Sym) -> Self {
ElfSym {
st_name: sym.st_name as usize,
st_info: sym.st_info,
st_other: sym.st_other,
st_shndx: sym.st_shndx as usize,
st_value: u64::from(sym.st_value),
st_size: u64::from(sym.st_size),
}
}
}
impl From<ElfSym> for Sym {
#[inline]
fn from(sym: ElfSym) -> Self {
Sym {
st_name: sym.st_name as u32,
st_info: sym.st_info,
st_other: sym.st_other,
st_shndx: sym.st_shndx as u16,
st_value: sym.st_value as $size,
st_size: sym.st_size as $size,
}
}
}
impl fmt::Debug for Sym {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let bind = st_bind(self.st_info);
let typ = st_type(self.st_info);
let vis = st_visibility(self.st_other);
f.debug_struct("Sym")
.field("st_name", &self.st_name)
.field("st_value", &format_args!("{:x}", self.st_value))
.field("st_size", &self.st_size)
.field("st_info", &format_args!("{:x} {} {}", self.st_info, bind_to_str(bind), type_to_str(typ)))
.field("st_other", &format_args!("{} {}", self.st_other, visibility_to_str(vis)))
.field("st_shndx", &self.st_shndx)
.finish()
}
}
#[inline]
pub unsafe fn from_raw<'a>(symp: *const Sym, count: usize) -> &'a [Sym] {
slice::from_raw_parts(symp, count)
}
if_std! {
use crate::error::Result;
use std::fs::File;
use std::io::{Read, Seek};
use std::io::SeekFrom::Start;
#[cfg(feature = "std")]
pub fn from_fd(fd: &mut File, offset: usize, count: usize) -> Result<Vec<Sym>> {
// TODO: AFAIK this shouldn't work, since i pass in a byte size...
let mut syms = vec![Sym::default(); count];
@ -251,7 +248,7 @@ macro_rules! elf_sym_std_impl {
syms.dedup();
Ok(syms)
}
} // end if_alloc
}
};
}
@ -280,7 +277,6 @@ pub mod sym32 {
pub st_shndx: u16,
}
use plain;
// Declare that the type is plain.
unsafe impl plain::Plain for Sym {}
@ -311,7 +307,6 @@ pub mod sym64 {
pub st_size: u64,
}
use plain;
// Declare that the type is plain.
unsafe impl plain::Plain for Sym {}
@ -320,112 +315,111 @@ pub mod sym64 {
elf_sym_std_impl!(u64);
}
use scroll::ctx;
use scroll::ctx::SizeWith;
use core::fmt::{self, Debug};
use core::result;
use crate::container::{Ctx, Container};
#[cfg(feature = "alloc")]
use crate::error::Result;
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
#[derive(Clone, Copy, PartialEq, Default)]
/// A unified Sym definition - convertible to and from 32-bit and 64-bit variants
pub struct Sym {
pub st_name: usize,
pub st_info: u8,
pub st_other: u8,
pub st_shndx: usize,
pub st_value: u64,
pub st_size: u64,
}
impl Sym {
#[inline]
pub fn size(container: Container) -> usize {
Self::size_with(&Ctx::from(container))
}
/// Checks whether this `Sym` has `STB_GLOBAL`/`STB_WEAK` bind and a `st_value` of 0
#[inline]
pub fn is_import(&self) -> bool {
let bind = self.st_bind();
(bind == STB_GLOBAL || bind == STB_WEAK) && self.st_value == 0
}
/// Checks whether this `Sym` has type `STT_FUNC`
#[inline]
pub fn is_function(&self) -> bool {
st_type(self.st_info) == STT_FUNC
}
/// Get the ST bind.
///
/// This is the first four bits of the "info" byte.
#[inline]
pub fn st_bind(&self) -> u8 {
self.st_info >> 4
}
/// Get the ST type.
///
/// This is the last four bits of the "info" byte.
#[inline]
pub fn st_type(&self) -> u8 {
st_type(self.st_info)
}
/// Get the ST visibility.
///
/// This is the last three bits of the "other" byte.
#[inline]
pub fn st_visibility(&self) -> u8 {
st_visibility(self.st_other)
}
#[cfg(feature = "endian_fd")]
/// Parse `count` vector of ELF symbols from `offset`
pub fn parse(bytes: &[u8], mut offset: usize, count: usize, ctx: Ctx) -> Result<Vec<Sym>> {
let mut syms = Vec::with_capacity(count);
for _ in 0..count {
let sym = bytes.gread_with(&mut offset, ctx)?;
syms.push(sym);
}
Ok(syms)
}
}
impl fmt::Debug for Sym {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let bind = self.st_bind();
let typ = self.st_type();
let vis = self.st_visibility();
f.debug_struct("Sym")
.field("st_name", &self.st_name)
.field("st_info", &format_args!("0x{:x} {} {}", self.st_info, bind_to_str(bind), type_to_str(typ)))
.field("st_other", &format_args!("{} {}", self.st_other, visibility_to_str(vis)))
.field("st_shndx", &self.st_shndx)
.field("st_value", &format_args!("0x{:x}", self.st_value))
.field("st_size", &self.st_size)
.finish()
}
}
impl ctx::SizeWith<Ctx> for Sym {
#[inline]
fn size_with(&Ctx {container, .. }: &Ctx) -> usize {
match container {
Container::Little => {
sym32::SIZEOF_SYM
},
Container::Big => {
sym64::SIZEOF_SYM
},
}
}
}
if_alloc! {
use scroll::ctx;
use scroll::ctx::SizeWith;
use core::fmt::{self, Debug};
use core::result;
use crate::container::{Ctx, Container};
use crate::error::Result;
use crate::alloc::vec::Vec;
#[derive(Default, PartialEq, Clone)]
/// A unified Sym definition - convertable to and from 32-bit and 64-bit variants
pub struct Sym {
pub st_name: usize,
pub st_info: u8,
pub st_other: u8,
pub st_shndx: usize,
pub st_value: u64,
pub st_size: u64,
}
impl Sym {
#[inline]
pub fn size(container: Container) -> usize {
use scroll::ctx::SizeWith;
Self::size_with(&Ctx::from(container))
}
/// Checks whether this `Sym` has `STB_GLOBAL`/`STB_WEAK` bind and a `st_value` of 0
#[inline]
pub fn is_import(&self) -> bool {
let bind = self.st_bind();
(bind == STB_GLOBAL || bind == STB_WEAK) && self.st_value == 0
}
/// Checks whether this `Sym` has type `STT_FUNC`
#[inline]
pub fn is_function(&self) -> bool {
st_type(self.st_info) == STT_FUNC
}
/// Get the ST bind.
///
/// This is the first four bits of the "info" byte.
#[inline]
pub fn st_bind(&self) -> u8 {
self.st_info >> 4
}
/// Get the ST type.
///
/// This is the last four bits of the "info" byte.
#[inline]
pub fn st_type(&self) -> u8 {
st_type(self.st_info)
}
/// Get the ST visibility.
///
/// This is the last three bits of the "other" byte.
#[inline]
pub fn st_visibility(&self) -> u8 {
st_visibility(self.st_other)
}
#[cfg(feature = "endian_fd")]
/// Parse `count` vector of ELF symbols from `offset`
pub fn parse(bytes: &[u8], mut offset: usize, count: usize, ctx: Ctx) -> Result<Vec<Sym>> {
use scroll::Pread;
let mut syms = Vec::with_capacity(count);
for _ in 0..count {
let sym = bytes.gread_with(&mut offset, ctx)?;
syms.push(sym);
}
Ok(syms)
}
}
impl fmt::Debug for Sym {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let bind = self.st_bind();
let typ = self.st_type();
let vis = self.st_visibility();
f.debug_struct("Sym")
.field("st_name", &self.st_name)
.field("st_info", &format_args!("0x{:x} {} {}", self.st_info, bind_to_str(bind), type_to_str(typ)))
.field("st_other", &format_args!("{} {}", self.st_other, visibility_to_str(vis)))
.field("st_shndx", &self.st_shndx)
.field("st_value", &format_args!("0x{:x}", self.st_value))
.field("st_size", &self.st_size)
.finish()
}
}
impl ctx::SizeWith<Ctx> for Sym {
#[inline]
fn size_with(&Ctx {container, .. }: &Ctx) -> usize {
match container {
Container::Little => {
sym32::SIZEOF_SYM
},
Container::Big => {
sym64::SIZEOF_SYM
},
}
}
}
impl<'a> ctx::TryFromCtx<'a, Ctx> for Sym {
type Error = crate::error::Error;
#[inline]
fn try_from_ctx(bytes: &'a [u8], Ctx { container, le}: Ctx) -> result::Result<(Self, usize), Self::Error> {
use scroll::Pread;
let sym = match container {
Container::Little => {
(bytes.pread_with::<sym32::Sym>(0, le)?.into(), sym32::SIZEOF_SYM)
@ -442,7 +436,6 @@ if_alloc! {
type Error = crate::error::Error;
#[inline]
fn try_into_ctx(self, bytes: &mut [u8], Ctx {container, le}: Ctx) -> result::Result<usize, Self::Error> {
use scroll::Pwrite;
match container {
Container::Little => {
let sym: sym32::Sym = self.into();
@ -459,7 +452,6 @@ if_alloc! {
impl ctx::IntoCtx<Ctx> for Sym {
#[inline]
fn into_ctx(self, bytes: &mut [u8], Ctx {container, le}: Ctx) {
use scroll::Pwrite;
match container {
Container::Little => {
let sym: sym32::Sym = self.into();
@ -472,7 +464,9 @@ if_alloc! {
}
}
}
}
if_alloc! {
#[derive(Default)]
/// An ELF symbol table, allowing lazy iteration over symbols
pub struct Symtab<'a> {
@ -488,7 +482,7 @@ if_alloc! {
let len = self.bytes.len();
fmt.debug_struct("Symtab")
.field("bytes", &len)
.field("range", &format!("{:#x}..{:#x}", self.start, self.end))
.field("range", &format_args!("{:#x}..{:#x}", self.start, self.end))
.field("count", &self.count)
.field("Symbols", &self.to_vec())
.finish()

View File

@ -4,7 +4,7 @@
use scroll;
use core::result;
use core::fmt;
use crate::alloc::string::String;
use alloc::string::String;
#[cfg(feature = "std")]
use std::{error, io};

View File

@ -10,7 +10,7 @@
//! * A PE32/PE32+ (64-bit) parser, and raw C structs
//! * A Unix archive parser and loader
//!
//! Goblin requires at least `rustc` 1.31.1, uses the 2018 rust edition, and is developed on stable.
//! Goblin requires at least `rustc` 1.36.0, uses the 2018 rust edition, and is developed on stable.
//!
//! Goblin primarily supports the following important use cases:
//!
@ -79,24 +79,14 @@
//! via `endian_fd`
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
#[cfg(feature = "std")]
extern crate core;
#[cfg(all(feature = "alloc", not(feature = "std")))]
#[cfg(feature = "alloc")]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
mod alloc {
pub use std::borrow;
pub use std::boxed;
pub use std::string;
pub use std::vec;
pub use std::collections;
}
/////////////////////////
// Misc/Helper Modules
/////////////////////////

View File

@ -11,8 +11,8 @@ use scroll::{Pread, Uleb128};
use crate::error;
use core::fmt::{self, Debug};
use crate::mach::load_command;
use crate::alloc::vec::Vec;
use crate::alloc::string::String;
use alloc::vec::Vec;
use alloc::string::String;
type Flag = u64;

View File

@ -7,7 +7,7 @@
use core::ops::Range;
use core::fmt::{self, Debug};
use scroll::{Sleb128, Uleb128, Pread};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use crate::container;
use crate::error;

View File

@ -1,6 +1,6 @@
//! The Mach-o, mostly zero-copy, binary format parser and raw struct definitions
use core::fmt;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use log::debug;

View File

@ -5,8 +5,8 @@ use log::{debug, warn};
use core::fmt;
use core::ops::{Deref, DerefMut};
use crate::alloc::boxed::Box;
use crate::alloc::vec::Vec;
use alloc::boxed::Box;
use alloc::vec::Vec;
use crate::container;
use crate::error;

View File

@ -1,5 +1,5 @@
use scroll::{Pread, Pwrite};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use log::debug;

View File

@ -1,4 +1,4 @@
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use crate::error;
use crate::pe::{optional_header, section_table, symbol};
use crate::strtab;

View File

@ -1,5 +1,5 @@
use crate::alloc::borrow::Cow;
use crate::alloc::vec::Vec;
use alloc::borrow::Cow;
use alloc::vec::Vec;
use core::fmt::{LowerHex, Debug};
use scroll::{Pread, Pwrite, SizeWith};

View File

@ -3,7 +3,7 @@
// TODO: panics with unwrap on None for apisetschema.dll, fhuxgraphics.dll and some others
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
pub mod header;
pub mod optional_header;

View File

@ -1,4 +1,4 @@
use crate::alloc::string::{String, ToString};
use alloc::string::{String, ToString};
use scroll::{ctx, Pread, Pwrite};
use crate::error::{self, Error};
use crate::pe::relocation;

View File

@ -1,4 +1,4 @@
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use crate::error;
use crate::strtab;
use core::fmt::{self, Debug};

View File

@ -1,5 +1,5 @@
use scroll::Pread;
use crate::alloc::string::ToString;
use alloc::string::ToString;
use crate::error;
use super::section_table;

View File

@ -8,7 +8,7 @@ use core::fmt;
use scroll::{ctx, Pread};
if_alloc! {
use crate::error;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
}
/// A common string table format which is indexed by byte offsets (and not