mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-02-12 01:55:48 +00:00
Define MAX_SIZE constant for CompactSize serialization
This commit is contained in:
parent
1f11c404dc
commit
cc183efda4
@ -1,6 +1,8 @@
|
|||||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
|
|
||||||
|
const MAX_SIZE: usize = 0x02000000;
|
||||||
|
|
||||||
struct CompactSize;
|
struct CompactSize;
|
||||||
|
|
||||||
impl CompactSize {
|
impl CompactSize {
|
||||||
@ -33,7 +35,7 @@ impl CompactSize {
|
|||||||
n => Ok(n as usize),
|
n => Ok(n as usize),
|
||||||
}
|
}
|
||||||
}? {
|
}? {
|
||||||
s if s > 0x02000000 => Err(io::Error::new(
|
s if s > MAX_SIZE => Err(io::Error::new(
|
||||||
io::ErrorKind::InvalidInput,
|
io::ErrorKind::InvalidInput,
|
||||||
"CompactSize too large",
|
"CompactSize too large",
|
||||||
)),
|
)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user