Skip to content

Commit

Permalink
Better PNG chunk length error message
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Nov 24, 2017
1 parent ce4479f commit 35f7a90
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MetadataExtractor/Formats/Png/PngChunkReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public IEnumerable<PngChunk> Extract([NotNull] SequentialReader reader, [CanBeNu
{
// Process the next chunk.
var chunkDataLength = reader.GetInt32();
if (chunkDataLength < 0)
throw new PngProcessingException("PNG chunk length exceeds maximum");
var chunkType = new PngChunkType(reader.GetBytes(4));
var willStoreChunk = desiredChunkTypes == null || desiredChunkTypes.Contains(chunkType);
var chunkData = reader.GetBytes(chunkDataLength);
Expand Down

0 comments on commit 35f7a90

Please sign in to comment.