Skip to content

Commit

Permalink
avoid infinite loop in #291, logic issue is still present for png pre…
Browse files Browse the repository at this point in the history
…dictor
  • Loading branch information
EliotJones committed Feb 23, 2021
1 parent 560e8ae commit cc81541
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/UglyToad.PdfPig/Filters/PngPredictor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public static byte[] Decode(byte[] inputBytes, int predictor, int colors, int bi
int offset = 0;
while (offset < rowlength && ((i = input.Read(actline, offset, rowlength - offset)) != -1))
{
if (i == 0)
{
// TODO: #291, this indicates a bug in reading logic.
// This only avoids the infinite loop it does not fix the logic bug.
break;
}

offset += i;
}

Expand Down

0 comments on commit cc81541

Please sign in to comment.