File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/ImageSharp/Formats/Png/Chunks
tests/ImageSharp.Tests/Formats/Png Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ public static FrameControl Parse(ReadOnlySpan<byte> data)
150150 {
151151 if ( data . Length < Size )
152152 {
153- PngThrowHelper . ThrowInvalidImageContentException ( "The Frame Control Chunk does not contain enough data!" ) ;
153+ PngThrowHelper . ThrowInvalidImageContentException ( "The frame control chunk does not contain enough data!" ) ;
154154 }
155155
156156 return new (
Original file line number Diff line number Diff line change @@ -92,6 +92,22 @@ public void Decode_TruncatedPhysChunk_ExceptionIsThrown()
9292 Assert . Equal ( "pHYs chunk is too short" , exception . Message ) ;
9393 }
9494
95+ // https://github.com/SixLabors/ImageSharp/issues/3093
96+ [ Fact ]
97+ public void Decode_TruncatedFrameControlChunk_ExceptionIsThrown ( )
98+ {
99+ // PNG signature + truncated frame control chunk
100+ byte [ ] payload = Convert . FromHexString (
101+ "89504e470d0a1a0a424d3a00000000007f000000000028030405060000000100" +
102+ "000101002000000000000000000000000000ff00006663544cff190000000000" +
103+ "010000424d000100000101002000000000" ) ;
104+
105+ using MemoryStream stream = new ( payload ) ;
106+ InvalidImageContentException exception = Assert . Throws < InvalidImageContentException > ( ( ) => Image . Load < Rgba32 > ( stream ) ) ;
107+
108+ Assert . Equal ( "The frame control chunk does not contain enough data!" , exception . Message ) ;
109+ }
110+
95111 // https://github.com/SixLabors/ImageSharp/issues/3079
96112 [ Fact ]
97113 public void Decode_CompressedTxtChunk_WithTruncatedData_DoesNotThrow ( )
You can’t perform that action at this time.
0 commit comments