giflib-rs 6.1.3

An AI-assisted port of giflib to Rust.
Documentation
  • Coverage
  • 16.99%
    26 out of 153 items documented0 out of 0 items with examples
  • Size
  • Source code size: 204.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 1c3t3a mhils

giflib-rs

giflib-rs is an AI-assisted port of giflib to Rust. It is an API-compatible drop-in replacement written in a memory safe language.

[!NOTE] If API compatibility is not a strict requirement, we recommend using the gif crate instead. It has idiomatic Rust APIs while being substantially faster.

Safety

giflib-rs does not use unsafe in any of the business logic, but requires unsafe to provide a C API and deal with pointers passed from C. We use safer_cffi to put up guardrails where possible.

Known Differentials

  • Setting GifFile->Error on invalid dimensions: When an image descriptor has invalid dimensions (width or height ≤ 0, or width × height overflow), C's DGifSlurp returns GIF_ERROR but does not set GifFile->Error (leaving it at 0). Rust's dgif_slurp returns GIF_ERROR and sets GifFile->Error = D_GIF_ERR_DATA_TOO_BIG (108).
    This is a deliberate change to remove what we consider a bug in C implementation.
  • File Writing: Rust checks the return code of write() calls and returns an error on failure. The C implementation silently ignores write failures and returns GIF_OK.
    This is a deliberate change to improve over the C version.
  • OOM Handling: The Rust version panics on allocation error, whereas the C version returns an error code. This typically does not affect Linux-based systems, which overcommit memory and then use the OOM Killer instead of failing allocations.

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.