-
Notifications
You must be signed in to change notification settings - Fork 668
Closed
Labels
Description
This happens in image::load_rect
function because BmpDecoder
implementation of ImageDecoderExt
trait provides seek_scanline
parameter which looks like this: |_, _| unreachable!()
. But it is reachable in runtime.
Expected
area of bmp image is read correctly by image::load_rect
function
Actual behaviour
Process panics with error:
thread 'main::tests::decode_bmp' panicked at 'internal error: entered unreachable code', /home/byshnev/.cargo/registry/src/github.com-1ecc6299db9ec823/image-0.23.13/./src/codecs/bmp/decoder.rs:1470:84
Reproduction steps
fn decode_bmp() {
let f = File::open("path/to/any_rgba8.bmp").unwrap();
let mut decoder = BmpDecoder::new(f).unwrap();
let mut buf: Vec<u8> = vec![0; decoder.total_bytes() as usize];
decoder.read_rect(0, 0, 8, 8, buf.as_bytes_mut()).unwrap(); // adjust width/height depending on image size
}