File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed
src/ImageSharp/Formats/Png Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -1101,10 +1101,7 @@ private bool TryReadChunk(out PngChunk chunk)
11011101
11021102 while ( length < 0 || length > ( this . currentStream . Length - this . currentStream . Position ) )
11031103 {
1104- // Not a valid chunk so we skip back all but one of the four bytes we have just read.
1105- // That lets us read one byte at a time until we reach a known chunk.
1106- this . currentStream . Position -= 3 ;
1107-
1104+ // Not a valid chunk so try again until we reach a known chunk.
11081105 if ( ! this . TryReadChunkLength ( out length ) )
11091106 {
11101107 chunk = default ;
Original file line number Diff line number Diff line change @@ -243,6 +243,23 @@ public void Issue1014<TPixel>(TestImageProvider<TPixel> provider)
243243 Assert . Null ( ex ) ;
244244 }
245245
246+ [ Theory ]
247+ [ WithFile ( TestImages . Png . Issue1127 , PixelTypes . Rgba32 ) ]
248+ public void Issue1127 < TPixel > ( TestImageProvider < TPixel > provider )
249+ where TPixel : struct , IPixel < TPixel >
250+ {
251+ System . Exception ex = Record . Exception (
252+ ( ) =>
253+ {
254+ using ( Image < TPixel > image = provider . GetImage ( PngDecoder ) )
255+ {
256+ image . DebugSave ( provider ) ;
257+ image . CompareToOriginal ( provider , ImageComparer . Exact ) ;
258+ }
259+ } ) ;
260+ Assert . Null ( ex ) ;
261+ }
262+
246263 [ Theory ]
247264 [ WithFile ( TestImages . Png . Splash , PixelTypes . Rgba32 ) ]
248265 [ WithFile ( TestImages . Png . Bike , PixelTypes . Rgba32 ) ]
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ public static class Png
9090 public const string Issue1014_4 = "Png/issues/Issue_1014_4.png" ;
9191 public const string Issue1014_5 = "Png/issues/Issue_1014_5.png" ;
9292 public const string Issue1014_6 = "Png/issues/Issue_1014_6.png" ;
93+ public const string Issue1127 = "Png/issues/Issue_1127.png" ;
9394
9495 public static class Bad
9596 {
You can’t perform that action at this time.
0 commit comments