Giter VIP home page Giter VIP logo

image-webp's People

Contributors

fintelia avatar okaneco avatar shnatsel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

image-webp's Issues

Add odd-width/odd-dimensioned lossy pixel tests and images

I noticed that all of the lossy reference images had even dimensions. I wasn't sure what the process was for adding new test images.

I wrote code that incorrectly handled some end pixels in rows but passed all the tests. I created these two tests to check that my function matched the current fill_single implementation. The 3x3 test is what my code failed at first since I was handling 2 pixels at a time due to the chroma plane.
okaneco@0f96c2e

Fuzz testing

We should add fuzz testing to detect any inputs that cause the decoder to crash

Memory limits

We should audit the decoder to ensure it is properly enforcing memory limits.

45% of the time decoding lossy images is spent in `fill_single`

It seems YUV to RGB conversion is now the bottleneck, accounting for 45% of the time.

Profile showing it: https://share.firefox.dev/46lRpxt

Test image: test_lossy.webp.gz

Measured on commit 18867ec

Code used:

use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let input = std::env::args().nth(1).unwrap();
    let f = std::fs::File::open(input)?;
    let reader = std::io::BufReader::new(f);
    let mut decoder = webp::WebPDecoder::new(reader)?;
    let mut output = vec![0u8; decoder.output_buffer_size()];
    let _img = decoder.read_image(&mut output)?;
    Ok(())
}

More panics on decoding still images

It seems that the AFL seeds for the WebP format are overly tuned to the libwebp implementation, and are not a good starting point for fuzzing other decoders.

When seeded with the smallest real-world images that I scraped from the web, the fuzzer still finds panics almost instantly:
smallest_scraped_webp.tar.gz

Sample image triggering a panic: crash-70d04adad08d65334cc6e947843ae382420aef78.webp.gz
which causes

thread '<unnamed>' panicked at image-webp/src/vp8.rs:851:14:
chunk size must be non-zero

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.