Skip to content

Commit

Permalink
Fix parsing 79-byte ICC profile name
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Dec 8, 2024
1 parent 2232f83 commit 79ae5e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/decoder/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1528,9 +1528,11 @@ impl StreamingDecoder {
let mut buf = &self.current_chunk.raw_bytes[..];

// read profile name
let _: u8 = buf.read_be()?;
for _ in 1..80 {
for len in 0..=80 {
let raw: u8 = buf.read_be()?;
if (raw == 0 && len == 0) || (raw != 0 && len == 80) {
return Err(DecodingError::from(TextDecodingError::InvalidKeywordSize));
}
if raw == 0 {
break;
}
Expand Down

0 comments on commit 79ae5e8

Please sign in to comment.