from_little_endian conversion can't fail.
This commit is contained in:
parent
ace9191299
commit
19c56c42b6
|
@ -545,7 +545,8 @@ impl<'a, E: Externals> Interpreter<'a, E> {
|
||||||
.expect("Due to validation memory should exists");
|
.expect("Due to validation memory should exists");
|
||||||
let b = m.get(address, mem::size_of::<T>())
|
let b = m.get(address, mem::size_of::<T>())
|
||||||
.map_err(|_| Error::Trap(Trap::MemoryAccessOutOfBounds))?;
|
.map_err(|_| Error::Trap(Trap::MemoryAccessOutOfBounds))?;
|
||||||
let n = T::from_little_endian(&b)?;
|
let n = T::from_little_endian(&b)
|
||||||
|
.expect("Can't fail since buffer length should be size_of::<T>");
|
||||||
context.value_stack_mut().push(n.into())?;
|
context.value_stack_mut().push(n.into())?;
|
||||||
Ok(InstructionOutcome::RunNextInstruction)
|
Ok(InstructionOutcome::RunNextInstruction)
|
||||||
}
|
}
|
||||||
|
@ -563,7 +564,8 @@ impl<'a, E: Externals> Interpreter<'a, E> {
|
||||||
.expect("Due to validation memory should exists");
|
.expect("Due to validation memory should exists");
|
||||||
let b = m.get(address, mem::size_of::<T>())
|
let b = m.get(address, mem::size_of::<T>())
|
||||||
.map_err(|_| Error::Trap(Trap::MemoryAccessOutOfBounds))?;
|
.map_err(|_| Error::Trap(Trap::MemoryAccessOutOfBounds))?;
|
||||||
let v = T::from_little_endian(&b)?;
|
let v = T::from_little_endian(&b)
|
||||||
|
.expect("Can't fail since buffer length should be size_of::<T>");
|
||||||
let stack_value: U = v.extend_into();
|
let stack_value: U = v.extend_into();
|
||||||
context
|
context
|
||||||
.value_stack_mut()
|
.value_stack_mut()
|
||||||
|
|
Loading…
Reference in New Issue