Skip to content

Commit

Permalink
Make the PCX magic bytes stricter
Browse files Browse the repository at this point in the history
  • Loading branch information
lupine authored and kornelski committed Nov 1, 2024
1 parent 1a0111f commit 1a78ef5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/image_reader/free_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub(crate) fn write_buffer_impl<W: std::io::Write + Seek>(
}
}

static MAGIC_BYTES: [(&[u8], ImageFormat); 24] = [
static MAGIC_BYTES: [(&[u8], ImageFormat); 25] = [
(b"\x89PNG\r\n\x1a\n", ImageFormat::Png),
(&[0xff, 0xd8, 0xff], ImageFormat::Jpeg),
(b"GIF89a", ImageFormat::Gif),
Expand All @@ -148,7 +148,8 @@ static MAGIC_BYTES: [(&[u8], ImageFormat); 24] = [
(b"\0\0\0\x1cftypavif", ImageFormat::Avif),
(&[0x76, 0x2f, 0x31, 0x01], ImageFormat::OpenExr), // = &exr::meta::magic_number::BYTES
(b"qoif", ImageFormat::Qoi),
(&[0x0A], ImageFormat::Pcx),
(&[0x0a, 0x02], ImageFormat::Pcx),
(&[0x0a, 0x05], ImageFormat::Pcx),
];

/// Guess image format from memory block
Expand Down

0 comments on commit 1a78ef5

Please sign in to comment.