Skip to content

Panic when decoding .ico #473

@frewsxcv

Description

@frewsxcv
extern crate image;

use std::io::Cursor;

fn main() {
    let input = b"\x30\x30\x30\x30\x01\x00\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x28\x00\x00\x00\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x28\x00\x00\x00\x30\x30\x30\x30\x00\x00\x00\x80".to_vec();
    let c = Cursor::new(input);
    image::ico::ICODecoder::new(c);
}
coreyf@frewbook-pro /t/tmp (master)> cargo run
     Running `target/debug/tmp`
thread '<main>' panicked at 'arithmetic operation overflowed', /Users/coreyf/.cargo/registry/src/github.com-0a35038f75765ae4/image-0.4.0/./src/bmp/decoder.rs:180
Process didn't exit successfully: `target/debug/tmp` (exit code: 101)

found using afl.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions