@@ -138,6 +138,29 @@ public void Decode_InternationalText_WithTruncatedData_DoesNotThrow()
138138 using Image < Rgba32 > image = Image . Load < Rgba32 > ( stream ) ;
139139 }
140140
141+ // https://github.com/SixLabors/ImageSharp/issues/3079
142+ [ Fact ]
143+ public void Decode_InternationalText_WithTruncatedDataAfterLanguageTag_DoesNotThrow ( )
144+ {
145+ byte [ ] payload = [ 137 , 80 , 78 , 71 , 13 , 10 , 26 , 10 , // PNG signature
146+ 0 , 0 , 0 , 13 , // chunk length 13 bytes
147+ 73 , 72 , 68 , 82 , // chunk type IHDR
148+ 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , // data
149+ 55 , 110 , 249 , 36 , // checksum
150+ 0 , 0 , 0 , 21 , // chunk length
151+ 105 , 84 , 88 , 116 , // chunk type iTXt
152+ 73 , 110 , 116 , 101 , 114 , 110 , 97 , 116 , 105 , 111 , 110 , 97 , 108 , 50 , 0 , 0 , 0 , 114 , 117 , 115 , 0 , // truncated data after language tag
153+ 225 , 200 , 214 , 33 , // crc
154+ 0 , 0 , 0 , 10 , // chunk length 10 bytes
155+ 73 , 68 , 65 , 84 , // chunk type IDAT
156+ 120 , 1 , 99 , 96 , 0 , 0 , 0 , 2 , 0 , 1 , // data
157+ 115 , 117 , 1 , 24 , // checksum
158+ 0 , 0 , 0 , 0 , 73 , 69 , 78 , 68 , 174 , 66 , 96 , 130 ] ; // end chunk
159+
160+ using MemoryStream stream = new ( payload ) ;
161+ using Image < Rgba32 > image = Image . Load < Rgba32 > ( stream ) ;
162+ }
163+
141164 private static string GetChunkTypeName ( uint value )
142165 {
143166 byte [ ] data = new byte [ 4 ] ;
0 commit comments