@@ -572,6 +572,7 @@ public void BmpDecoder_ThrowsException_Issue2696<TPixel>(TestImageProvider<TPixe
572572 Assert . IsType < InvalidMemoryOperationException > ( ex . InnerException ) ;
573573 }
574574
575+ // https://github.com/SixLabors/ImageSharp/issues/3067
575576 [ Fact ]
576577 public void BmpDecoder_ThrowsException_Issue3067 ( )
577578 {
@@ -594,4 +595,32 @@ public void BmpDecoder_ThrowsException_Issue3067()
594595 using Image image = BmpDecoder . Instance . Decode ( DecoderOptions . Default , stream ) ;
595596 } ) ;
596597 }
598+
599+ // https://github.com/SixLabors/ImageSharp/issues/3074
600+ [ Fact ]
601+ public void BmpDecoder_ThrowsException_Issue3074 ( )
602+ {
603+ // Crafted BMP: pixel data offset = 0x7FFFFFFF, actual file = 35 bytes
604+ byte [ ] data =
605+ [
606+ 0x42 , 0x4D , // "BM" signature
607+ 0x3A , 0x00 , 0x00 , 0x00 , // file size: 58
608+ 0x00 , 0x00 , 0x00 , 0x00 , // reserved
609+ 0xFF , 0xFF , 0xFF , 0x7F , // pixel offset: 0x7FFFFFFF (2,147,483,647)
610+ 0x28 , 0x00 , 0x00 , 0x00 , // DIB header size: 40
611+ 0x01 , 0x00 , 0x00 , 0x00 , // width: 1
612+ 0x01 , 0xFF , 0x00 , 0x00 , // height: 65281
613+ 0x01 , 0x00 , // color planes: 1
614+ 0x08 , 0x00 , // bits per pixel: 8
615+ 0x00 , 0x00 , 0x00 , 0x00 , // compression: RGB
616+ 0x00 , 0x00 , 0x00 // (truncated)
617+ ] ;
618+
619+ using MemoryStream stream = new ( data ) ;
620+
621+ Assert . Throws < InvalidImageContentException > ( ( ) =>
622+ {
623+ using Image < Rgba32 > image = Image . Load < Rgba32 > ( stream ) ;
624+ } ) ;
625+ }
597626}
0 commit comments