Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to image-webp #2148

Merged
merged 7 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: ["1.63.0", nightly, beta]
rust: ["1.67.1", nightly, beta]
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@nightly
if: ${{ matrix.rust == '1.63.0' }}
if: ${{ matrix.rust == '1.67.1' }}
- name: Generate Cargo.lock with minimal-version dependencies
if: ${{ matrix.rust == '1.63.0' }}
if: ${{ matrix.rust == '1.67.1' }}
run: cargo -Zminimal-versions generate-lockfile

- uses: dtolnay/rust-toolchain@v1
Expand All @@ -58,7 +58,7 @@ jobs:
- name: build
run: cargo build -v
- name: test
if: ${{ matrix.rust != '1.63.0' }}
if: ${{ matrix.rust != '1.67.1' }}
run: cargo test -v && cargo doc -v

test_other_archs:
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
resolver = "2"

# note: when changed, also update test runner in `.github/workflows/rust.yml`
rust-version = "1.63.0"
rust-version = "1.67.1"

license = "MIT OR Apache-2.0"
description = "Imaging library. Provides basic image processing and encoders/decoders for common image formats."
Expand Down Expand Up @@ -45,6 +45,7 @@ dav1d = { version = "0.10.2", optional = true }
dcv-color-primitives = { version = "0.6.1", optional = true }
exr = { version = "1.5.0", optional = true }
gif = { version = "0.13", optional = true }
image-webp = { version = "0.1.0", optional = true }
mp4parse = { version = "0.17.0", optional = true }
png = { version = "0.17.6", optional = true }
qoi = { version = "0.4", optional = true }
Expand Down Expand Up @@ -84,7 +85,7 @@ pnm = []
qoi = ["dep:qoi"]
tga = []
tiff = ["dep:tiff"]
webp = []
webp = ["dep:image-webp"]

# Other features
rayon = ["dep:rayon"] # Enables multi-threading
Expand Down
4 changes: 3 additions & 1 deletion fuzz-afl/fuzzers/fuzz_webp.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
extern crate afl;
extern crate image;

use std::io::Cursor;

use image::{DynamicImage, ImageDecoder};
use image::error::{ImageError, ImageResult, LimitError, LimitErrorKind};

#[inline(always)]
fn webp_decode(data: &[u8]) -> ImageResult<DynamicImage> {
let decoder = image::codecs::webp::WebPDecoder::new(data)?;
let decoder = image::codecs::webp::WebPDecoder::new(Cursor::new(data))?;
let (width, height) = decoder.dimensions();

if width.saturating_mul(height) > 4_000_000 {
Expand Down
4 changes: 3 additions & 1 deletion fuzz-afl/reproducers/reproduce_webp.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
extern crate image;

use std::io::Cursor;

use image::{DynamicImage, ImageDecoder};
use image::error::{ImageError, ImageResult, LimitError, LimitErrorKind};

mod utils;

#[inline(always)]
fn webp_decode(data: &[u8]) -> ImageResult<DynamicImage> {
let decoder = image::codecs::webp::WebPDecoder::new(data)?;
let decoder = image::codecs::webp::WebPDecoder::new(Cursor::new(data))?;
let (width, height) = decoder.dimensions();

if width.saturating_mul(height) > 4_000_000 {
Expand Down
Loading
Loading