Skip to content

Commit

Permalink
Fixed PNG compressed iTXt chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
reinfallt committed May 5, 2024
1 parent ed79cc0 commit f0e3ae6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MetadataExtractor/Formats/Png/PngMetadataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ private static IEnumerable<Directory> ProcessChunk(PngChunk chunk)
{
if (compressionMethod == 0)
{
if (!TryDeflate(bytes, bytesLeft, out textBytes, out string? errorMessage))
reader.Skip(2); // Skip over the zlib header bytes (78 9C)
bytesLeft -= 2;
if (!TryDeflate(reader.GetBytes(bytesLeft), bytesLeft, out textBytes, out string? errorMessage))
{
var directory = new PngDirectory(PngChunkType.iTXt);
directory.AddError($"Exception decompressing PNG {nameof(PngChunkType.iTXt)} chunk with keyword \"{keyword}\": {errorMessage}");
Expand Down

0 comments on commit f0e3ae6

Please sign in to comment.