Improve shape check
This commit is contained in:
1 parent
05a31fbad1
commit
5212242934
1 file changed
+6
-2
@@ -345,8 +345,12 @@ impl EventFull {
|
|||||||
// NOTE
|
// NOTE
|
||||||
// We only know the number of pixels from the compressed blob but we can't
|
// We only know the number of pixels from the compressed blob but we can't
|
||||||
// know the actual shape.
|
// know the actual shape.
|
||||||
// Can only rely on user input.
|
// Can only rely on user input and check that total number of pixels agree.
|
||||||
Ok(Shape::Image(*a, *b))
|
if *a * *b != n {
|
||||||
|
Err(DecompError::ShapeMakesNoSense)
|
||||||
|
} else {
|
||||||
|
Ok(Shape::Image(*a, *b))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => Err(DecompError::ShapeMakesNoSense),
|
Err(_) => Err(DecompError::ShapeMakesNoSense),
|
||||||
|
|||||||
Reference in new issue
Block a user