Fix out of bounds subtraction with invalid JPEG table
This commit is contained in:
1 parent
5b7814c994
commit
03b6ed413b
3 files changed
+43
-1
No files matched your search
@@ -225,6 +225,12 @@ impl JpegReader {
|
||||
|
||||
match jpeg_tables {
|
||||
Some(tables) => {
|
||||
assert!(
|
||||
tables.len() >= 2,
|
||||
"jpeg_tables, if given, must be at least 2 bytes long. Got {:?}",
|
||||
tables
|
||||
);
|
||||
|
||||
let mut jpeg_data = tables.clone();
|
||||
let truncated_length = jpeg_data.len() - 2;
|
||||
jpeg_data.truncate(truncated_length);
|
||||
|
||||
Reference in new issue
Block a user