pub enum Error {
Show 15 variants
Goblin(String),
Not32Bit {
magic: u16,
},
TooShort {
expected: usize,
actual: usize,
context: &'static str,
},
OverlayNotFound,
SignatureNotFound,
InvalidFirstHeaderFlags {
flags: u32,
},
DecompressionFailed {
method: &'static str,
detail: String,
},
UnsupportedCompression,
OutputTooLarge {
limit: usize,
},
InvalidBlockOffset {
block: &'static str,
offset: u32,
},
InvalidMagic {
expected: u32,
got: u32,
},
InvalidBlockIndex {
index: usize,
},
InvalidStringOffset {
offset: u32,
},
InvalidSpecialCode {
code: u8,
},
InvalidOpcode {
which: u32,
},
}Expand description
All errors that can occur during NSIS installer parsing.
Each variant carries enough context for a useful diagnostic message. The enum is intentionally flat (not hierarchical) to keep the API surface simple.
Variants§
Goblin(String)
The underlying PE parser (goblin) failed.
The inner string contains the stringified goblin error.
We stringify because goblin::error::Error does not implement Clone/Eq.
Not32Bit
The PE optional header magic is not 0x010B (PE32).
NSIS installers are always 32-bit PE executables.
TooShort
A buffer or structure is too short.
The parser expected at least expected bytes but found only actual.
Fields
OverlayNotFound
No PE overlay was found after the last section.
NSIS data is appended as a PE overlay; a file with no overlay cannot be an NSIS installer.
SignatureNotFound
No valid NSIS FirstHeader signature was found in the overlay.
The scanner checked 512-byte aligned offsets first and then
non-aligned fallback offsets for a structurally usable 0xDEADBEEF +
"NullsoftInst" magic sequence.
InvalidFirstHeaderFlags
The FirstHeader flags field contains invalid bits.
DecompressionFailed
Decompression of an NSIS data block failed.
Fields
UnsupportedCompression
None of the supported compression methods could decompress the data.
OutputTooLarge
Decompression produced more output than the configured budget allows.
Raised when a stream of unknown decompressed size (per-file, solid, or
uninstaller data) expands past the caller’s max_decompressed_size
budget. This guards against decompression bombs; the offending stream is
rejected rather than silently truncated.
InvalidBlockOffset
A block header references an offset beyond the decompressed data.
Fields
InvalidMagic
A magic value did not match the expected constant.
InvalidBlockIndex
A block index is out of the valid range (0..8).
InvalidStringOffset
A string table offset is out of range.
InvalidSpecialCode
An unrecognized special code was encountered in the string table.
InvalidOpcode
An entry’s which field does not map to a known opcode.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for Error
impl From<Error> for Error
Source§fn from(e: Error) -> Self
fn from(e: Error) -> Self
Converts a goblin parsing error into our Error::Goblin variant.