Test for short JPEG tag

This commit is contained in:
5225225 committed 2021-05-29 22:12:35 +01:00
1 parent 03b6ed413b
commit 65a1fbe8ae
3 files changed
+40 -1

No files matched your search

+6
View File
@@ -231,6 +231,12 @@ impl JpegReader {
tables
);
assert!(
length >= 2,
"if jpeg_tables is given, length must be at least 2 bytes long, got {}",
length
);
let mut jpeg_data = tables.clone();
let truncated_length = jpeg_data.len() - 2;
jpeg_data.truncate(truncated_length);