Browse Source

Define MAX_SIZE constant for CompactSize serialization

hush
Jack Grigg 6 years ago
parent
commit
cc183efda4
No known key found for this signature in database GPG Key ID: 1B8D649257DB0829
  1. 4
      zcash_primitives/src/serialize.rs

4
zcash_primitives/src/serialize.rs

@ -1,6 +1,8 @@
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use std::io::{self, Read, Write};
const MAX_SIZE: usize = 0x02000000;
struct CompactSize;
impl CompactSize {
@ -33,7 +35,7 @@ impl CompactSize {
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,
"CompactSize too large",
)),

Loading…
Cancel
Save