Fix: check decode buffer end after the run opcode
This commit is contained in:
parent
4067d83829
commit
0d612fd3c2
2 changed files with 6 additions and 5 deletions
|
|
@ -12,6 +12,7 @@ pub enum Error {
|
|||
InputBufferTooSmall { size: usize, required: usize },
|
||||
OutputBufferTooSmall { size: usize, required: usize },
|
||||
InvalidMagic { magic: u32 },
|
||||
UnexpectedBufferEnd,
|
||||
// TODO: invalid colorspace
|
||||
}
|
||||
|
||||
|
|
@ -38,6 +39,9 @@ impl Display for Error {
|
|||
Self::InvalidMagic { magic } => {
|
||||
write!(f, "invalid magic: expected {:?}, got {:?}", QOI_MAGIC, magic)
|
||||
}
|
||||
Self::UnexpectedBufferEnd => {
|
||||
write!(f, "unexpected input buffer end while decoding")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue