Coder Social home page Coder Social logo

webp-animation's Introduction

Hello world!

webp-animation's People

Contributors

amv-dev avatar blaind avatar dependabot[bot] avatar msrd0 avatar sommd avatar vkill avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

webp-animation's Issues

Null pointer dereference in test case `webp_data::tests::test_encoder`

I've been developing an experimental version of Miri that can execute foreign functions by interpreting LLVM bytecode.

Miri found the following error when executing the test webp_data::tests::test_encoder at version 0.9.0 of webp-animation.

error: Undefined Behavior: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
   --> .../rust/library/core/src/slice/raw.rs:101:9
    |
101 |         &*ptr::slice_from_raw_parts(data, len)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
    = note: BACKTRACE:
    = note: inside `std::slice::from_raw_parts::<'_, u8>` at .../rust/library/core/src/slice/raw.rs:101:9: 101:47
note: inside `webp_data::WebPData::as_slice`
   --> src/webp_data.rs:27:18
    |
27  |         unsafe { slice::from_raw_parts(self.data.bytes, self.data.size) }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `<webp_data::WebPData as std::ops::Deref>::deref`
   --> src/webp_data.rs:41:9
    |
41  |         self.as_slice()
    |         ^^^^^^^^^^^^^^^
note: inside `webp_data::tests::test_encoder`
   --> src/webp_data.rs:58:20
    |
58  |         assert_eq!(data.len(), 0);
    |                    ^^^^^^^^^^
note: inside closure
   --> src/webp_data.rs:56:23
    |
55  |     #[test]
    |     ------- in this procedural macro expansion
56  |     fn test_encoder() {
    | 

It seems like WebPData::new() does not actually initialize the WebPData struct to point to valid memory. In particular, here's where data is initialized in Rust:

let mut data = mem::zeroed();
webp::WebPDataInit(&mut data);
data

It seems like webp::WebPDataInit just zero-initializes the memory that it's passed:

static inline void WebPDataInit(WebPData* webp_data) {
  if (webp_data != ((void*)0)) {
    memset(webp_data, 0, sizeof(*webp_data));
  }
}

However, this shouldn't be necessary, since the memory being referenced has already been initialized by mem::zeroed() in Rust. Anyway, it seems like the implementation of WebPData::as_slice needs to account for the case when data is NULL.

Please support ColorMode::Rgb (no alpha channel)

Hi!

My input is in RGB format, with no alpha channel.

To encode this I'd like to specify ColorMode::Rgb, but the currently supported color modes have alpha channels:

/// Color Mode that configures the output type of [`Decoder`] [`Frame`]'s
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum ColorMode {
/// Rgba (red, green, blue, alpha)
Rgba,
/// Bgra (blue, green, red, alpha)
Bgra,
// what about MODE_rgbA and MODE_bgrA ?
}

Could you please add an RGB ColorMode?

Frame Rate

After decode an animated webp file I need to encode it to gif with another libray. It works but I dont know the frame rate and new gif has different speed.

Is there a way to get frame rates? If there is no such a feature it would be very useful.

Thank you for this amazing library.

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.