image-rs / image

Encoding and decoding images in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic when decoding ICO

frewsxcv opened this issue · comments

extern crate image;

use std::io::Cursor;

fn main() {
    let input = b"\x30\x30\x30\x30\x04\x00\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\xb6\x00\x00\x00\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x00\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x0c\x00\x00\x00\x30\x30\x30\x30\x30\x30\x08\x00".to_vec();
    let c = Cursor::new(input);
    let _ = image::ico::ICODecoder::new(c);
}
coreyf@frewbook-pro /t/imagee (master) [101]> cargo run
   Compiling imagee v0.1.0 (file:///private/tmp/imagee)
     Running `target/debug/imagee`
thread '<main>' panicked at 'index out of bounds: the len is 0 but the index is 0', ../src/libcollections/vec.rs:1110
Process didn't exit successfully: `target/debug/imagee` (exit code: 101)

found using afl.rs

Closed by #535