Skip to content

Commit

Permalink
metadata: validate min chunk length for jpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
sscobici committed Jan 18, 2025
1 parent 0affead commit 9015455
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ geckoxx [https://github.com/geckoxx]
Herohtar [https://github.com/herohtar]
nicholaswyoung [https://github.com/nicholaswyoung]
richardmitic [https://github.com/richardmitic]
sscobici [https://github.com/sscobici]
terrorfisch [https://github.com/terrorfisch]
Tommoa [https://github.com/Tommoa]
3 changes: 3 additions & 0 deletions symphonia-metadata/src/utils/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ fn parse_jpeg(mut reader: BufReader<'_>) -> Result<ImageInfo> {

return Ok(info);
}
if chunk_len < 2 {
return decode_error("meta (jpeg): invalid chunk length");
}

// Ignore the chunk. Exclude the chunk length that has already been read.
reader.ignore_bytes(u64::from(chunk_len) - 2)?;
Expand Down

0 comments on commit 9015455

Please sign in to comment.