File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/ImageSharp/Formats/Png/Chunks Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,13 @@ public void WriteTo(Span<byte> buffer)
147147 /// <param name="data">The data to parse.</param>
148148 /// <returns>The parsed fcTL.</returns>
149149 public static FrameControl Parse ( ReadOnlySpan < byte > data )
150- => new (
150+ {
151+ if ( data . Length < Size )
152+ {
153+ PngThrowHelper . ThrowInvalidImageContentException ( "The Frame Control Chunk does not contain enough data!" ) ;
154+ }
155+
156+ return new (
151157 sequenceNumber : BinaryPrimitives . ReadUInt32BigEndian ( data [ ..4 ] ) ,
152158 width : BinaryPrimitives . ReadUInt32BigEndian ( data [ 4 ..8 ] ) ,
153159 height : BinaryPrimitives . ReadUInt32BigEndian ( data [ 8 ..12 ] ) ,
@@ -157,4 +163,5 @@ public static FrameControl Parse(ReadOnlySpan<byte> data)
157163 delayDenominator : BinaryPrimitives . ReadUInt16BigEndian ( data [ 22 ..24 ] ) ,
158164 disposalMode : ( FrameDisposalMode ) ( data [ 24 ] + 1 ) ,
159165 blendMode : ( FrameBlendMode ) data [ 25 ] ) ;
166+ }
160167}
You can’t perform that action at this time.
0 commit comments