Memory-safe C library for parsing untrusted file formats
This is a build2 package for the wuffs
library. It provides memory-safe parsers and decoders for untrusted file
formats (images, compression, and related data).
Usage
To start using libwuffs in your project, add the following depends
value to your manifest, adjusting the version constraint as appropriate:
depends: libwuffs ^0.3.5
Then import the library in your buildfile:
import libs = libwuffs%lib{wuffs}
Include the public header with:
#include <wuffs/wuffs.h>
Importable targets
This package provides the following importable targets:
Reviews
Builds
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_ubuntu_26.04-gcc_15-bindist |
| timestamp |
2026-09-01 13:47:31 UTC (11 22:02:08 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-apple-darwin23.5.0 |
| tgt config |
macos_14-gcc_14_homebrew-static_O3 |
| timestamp |
2026-09-01 13:46:45 UTC (11 22:02:54 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-apple-darwin23.5.0 |
| tgt config |
macos_14-gcc_14_homebrew-O3 |
| timestamp |
2026-09-01 13:45:54 UTC (11 22:03:45 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-apple-darwin23.5.0 |
| tgt config |
macos_14-gcc_14_homebrew |
| timestamp |
2026-09-01 13:45:03 UTC (11 22:04:36 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-apple-darwin23.5.0 |
| tgt config |
macos_14-clang_15.0-static_O3 |
| timestamp |
2026-09-01 12:41:06 UTC (11 23:08:33 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-apple-darwin23.5.0 |
| tgt config |
macos_14-clang_15.0-O3 |
| timestamp |
2026-09-01 12:40:14 UTC (11 23:09:25 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-apple-darwin23.5.0 |
| tgt config |
macos_14-clang_15.0 |
| timestamp |
2026-09-01 12:39:22 UTC (11 23:10:17 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-clang_18_libc++-static_O3 |
| timestamp |
2026-09-01 10:53:25 UTC (12 00:56:14 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-clang_18_libc++-O3 |
| timestamp |
2026-09-01 10:52:55 UTC (12 00:56:44 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-clang_18_libc++ |
| timestamp |
2026-09-01 10:52:48 UTC (12 00:56:50 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-clang_18-static_O3 |
| timestamp |
2026-09-01 10:52:19 UTC (12 00:57:20 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-clang_18-O3 |
| timestamp |
2026-09-01 10:52:08 UTC (12 00:57:31 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-clang_18 |
| timestamp |
2026-09-01 10:51:45 UTC (12 00:57:54 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_fedora_44-gcc_16-bindist |
| timestamp |
2026-09-01 10:51:12 UTC (12 00:58:27 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_22_libc++-O3 |
| timestamp |
2026-09-01 10:49:57 UTC (12 00:59:42 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_22_libc++-static_O3 |
| timestamp |
2026-09-01 10:49:56 UTC (12 00:59:43 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_22_libc++ |
| timestamp |
2026-09-01 10:49:31 UTC (12 01:00:08 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_22-static_O3 |
| timestamp |
2026-09-01 10:49:17 UTC (12 01:00:22 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_22-O3 |
| timestamp |
2026-09-01 10:49:15 UTC (12 01:00:23 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-w64-mingw32 |
| tgt config |
windows_10-gcc_15.2_mingw_w64-static_O2 |
| timestamp |
2026-09-01 10:48:47 UTC (12 01:00:52 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_22 |
| timestamp |
2026-09-01 10:48:46 UTC (12 01:00:53 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-microsoft-win32-msvc14.5 |
| tgt config |
windows_10-msvc_18-static_O2 |
| timestamp |
2026-09-01 10:48:40 UTC (12 01:00:59 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-w64-mingw32 |
| tgt config |
windows_10-gcc_15.2_mingw_w64-O2 |
| timestamp |
2026-09-01 10:48:27 UTC (12 01:01:12 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-w64-mingw32 |
| tgt config |
windows_10-gcc_15.2_mingw_w64 |
| timestamp |
2026-09-01 10:48:27 UTC (12 01:01:12 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-microsoft-win32-msvc14.5 |
| tgt config |
windows_10-clang_21_msvc_18-static_O2 |
| timestamp |
2026-09-01 10:48:15 UTC (12 01:01:24 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-microsoft-win32-msvc14.5 |
| tgt config |
windows_10-msvc_18-O2 |
| timestamp |
2026-09-01 10:48:08 UTC (12 01:01:30 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-microsoft-win32-msvc14.5 |
| tgt config |
windows_10-msvc_18 |
| timestamp |
2026-09-01 10:48:06 UTC (12 01:01:33 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-microsoft-win32-msvc14.5 |
| tgt config |
windows_10-clang_21_msvc_18-O2 |
| timestamp |
2026-09-01 10:47:59 UTC (12 01:01:40 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-microsoft-win32-msvc14.5 |
| tgt config |
windows_10-clang_21_msvc_18 |
| timestamp |
2026-09-01 10:47:55 UTC (12 01:01:44 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-gcc_16-static_O3 |
| timestamp |
2026-09-01 10:47:30 UTC (12 01:02:09 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-microsoft-win32-msvc14.3 |
| tgt config |
windows_10-msvc_17 |
| timestamp |
2026-09-01 10:47:29 UTC (12 01:02:10 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-gcc_14-bindist |
| timestamp |
2026-09-01 10:47:20 UTC (12 01:02:18 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_ubuntu_24.04-gcc_13-bindist |
| timestamp |
2026-09-01 10:47:18 UTC (12 01:02:21 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-apple-darwin22.5.0 |
| tgt config |
macos_13-clang_15.0 |
| timestamp |
2026-09-01 10:47:14 UTC (12 01:02:25 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-gcc_16-ndebug_O3 |
| timestamp |
2026-09-01 10:47:12 UTC (12 01:02:27 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-gcc_16-O3 |
| timestamp |
2026-09-01 10:47:12 UTC (12 01:02:27 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-gcc_15-O3 |
| timestamp |
2026-09-01 10:46:56 UTC (12 01:02:43 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_fedora_43-gcc_15-bindist |
| timestamp |
2026-09-01 10:46:56 UTC (12 01:02:43 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-gcc_16 |
| timestamp |
2026-09-01 10:46:46 UTC (12 01:02:53 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-gcc_15 |
| timestamp |
2026-09-01 10:46:44 UTC (12 01:02:55 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_21_libc++ |
| timestamp |
2026-09-01 10:46:27 UTC (12 01:03:12 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-freebsd15.0 |
| tgt config |
freebsd_15-clang_19-static_O3 |
| timestamp |
2026-09-01 10:46:21 UTC (12 01:03:18 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-linux-gnu |
| tgt config |
linux_debian_13-clang_21 |
| timestamp |
2026-09-01 10:46:03 UTC (12 01:03:35 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-freebsd15.0 |
| tgt config |
freebsd_15-clang_19-O3 |
| timestamp |
2026-09-01 10:46:00 UTC (12 01:03:39 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-freebsd15.0 |
| tgt config |
freebsd_15-clang_19 |
| timestamp |
2026-09-01 10:45:47 UTC (12 01:03:52 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
x86_64-freebsd14.1 |
| tgt config |
freebsd_14-clang_18 |
| timestamp |
2026-09-01 10:45:41 UTC (12 01:03:58 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-gcc_14-static_O3 |
| timestamp |
2026-09-01 10:34:24 UTC (12 01:15:15 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-gcc_14-ndebug_O3 |
| timestamp |
2026-09-01 10:33:53 UTC (12 01:15:46 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-gcc_14-O3 |
| timestamp |
2026-09-01 10:33:42 UTC (12 01:15:57 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-gcc_14 |
| timestamp |
2026-09-01 10:33:15 UTC (12 01:16:24 days ago) |
| result |
success | log | rebuild |
| toolchain |
public-0.18.1 |
| target |
aarch64-linux-gnu |
| tgt config |
linux_debian_12-gcc_13 |
| timestamp |
2026-09-01 10:09:07 UTC (12 01:40:32 days ago) |
| result |
success | log | rebuild |
Changes
Changelog
2024-04-19 version 0.3.4
- Have
std/png ignore tRNS chunks for color types 4 (YA) and 6 (RGBA).
2023-04-08 version 0.3.3
The wuffs_base__parse_number_f64 function has been further optimized.
2023-04-07 version 0.3.2
The std/bmp and std/nie image decoders' decode_frame method now allow
decoding to a pixel buffer that's smaller than the source image. This makes
these two image decoders consistent with the other ones in std.
2023-03-04 version 0.3.1
For a closed io_reader, the standard library now returns "#truncated input" instead of "$short read". Importantly, this is an error, not a
suspension.
The wuffs_base__parse_number_f64 function's Simple Decimal Conversion
fallback algorithm has been optimized.
2023-01-26 version 0.3.0
The headline feature is that we have a production quality PNG decoder. It's
also the fastest, safest PNG decoder in the
world.
There's also a memory-safe, zero-allocation JSON
decoder.
The dot points below probably aren't of interest unless you're upgrading from
Wuffs version 0.2.
- Added
0b prefixed binary numbers.
- Added
WUFFS_BASE__PIXEL_BLEND__SRC_OVER.
- Added
WUFFS_BASE__PIXEL_FORMAT__BGR_565.
- Added
WUFFS_CONFIG__MODULE__BASE__ETC sub-modules.
- Added
auxiliary code.
- Added
base library support for UTF-8.
- Added
base library support for atoi-like string conversion.
- Added
choose and choosy.
- Added
cpu_arch.
- Added
doc/logo.
- Added
endwhile syntax.
- Added
example/bzcat.
- Added
example/cbor-to-json.
- Added
example/convert-to-nia.
- Added
example/imageviewer.
- Added
example/json-to-cbor.
- Added
example/jsonfindptrs.
- Added
example/jsonptr.
- Added
example/sdl-imageviewer.
- Added
slice base.u8 peek/poke methods.
- Added
std/bmp.
- Added
std/bzip2.
- Added
std/cbor.
- Added
std/json.
- Added
std/nie.
- Added
std/png.
- Added
std/tga.
- Added
std/wbmp.
- Added
tell_me_more? mechanism.
- Added SIMD.
- Added alloc functions.
- Added colons to const syntax.
- Added double-curly blocks.
- Added interfaces.
- Added iterate advance parameter.
- Added single-quoted strings.
- Added slice
uintptr_low_12_bits method.
- Added tokens.
- Changed
gif.decoder_workbuf_len_max_incl_worst_case from 1 to 0.
- Changed default C compilers from
clang-5.0,gcc to clang,gcc.
- Changed the C formatting style; removed the
-cformatter flag.
- Changed what the
std/gif benchmarks actually measure.
- Made
wuffs_base__pixel_format a struct.
- Made
wuffs_base__pixel_subsampling a struct.
- Made
wuffs_base__status a struct.
- Prohibited iterate loops inside coroutines.
- Removed
ack_metadata_chunk?.
- Removed
wuffs_base__frame_config__blend.
- Renamed I/O
available methods to length.
- Renamed
decode_io_writer? methods to transform_io?.
- Renamed
example/library to example/toy-genlib.
- Renamed
load and store to peek and poke.
- Renamed
{read,writ}er_io_position to {read,writ}er_position.
- Renamed
set_ignore_checksum! as a quirk.
- Renamed
swizzle_interleaved! to swizzle_interleaved_from_slice!.
- Renamed warnings to notes.
2019-12-19 version 0.2.0
The headline feature is that the GIF decoder is now of production quality.
There is now API for overall metadata (e.g. ICCP color profiles) and to
recreate each frame (width, height, BGRA pixels, timing, etc.) of a GIF
animation, instead of version 0.1's proof-of-concept GIF decoder API, which
just gave you a one-dimensional stream of palette indexes. It also now accepts
a variety of GIF images that are invalid, when strictly following the GIF
specifiction, but are nonetheless accepted by other real world GIF
implementations. The Wuffs GIF decoder has also been optimized to be about 1.5x
faster than Wuffs version 0.1 and about 2x faster than giflib (the C library).
The Wuffs GIF decoder is being trialled by Skia, the 2-D graphics library used
by both the Android operating system and the Chromium web browser.
Work also proceeds on the NIE and RAC file formats, but both are still
experimental and may change later in backwards incompatible ways.
The dot points below probably aren't of interest unless you're upgrading from
Wuffs version 0.1.
- Renamed Puffs to Wuffs.
- Ship as a "single file C library"
- Added a
skipgendeps flag.
- Added a
nullptr literal and nptr T type.
- Added
io_bind and io_limit keywords.
- Added a
use keyword.
- Added a
yield keyword.
- Made the
return value mandatory; added ok literal.
- Restricted
var statements to the top of functions.
- Dropped the
= RHS out of var x T = RHS.
- Changed func out-type from struct to bare type.
- Renamed the implicit
in variable to args.
- Added an implicit
coroutine_resumed variable.
- Added
std/adler32, std/crc32 and std/gzip.
- Added
std/gif quirks.
- Spun
std/lzw out of std/gif.
- Spun
std/zlib out of std/flate.
- Let the
std/gzip and std/zlib decoder ignore checksums.
- Renamed
std/flate to std/deflate.
- Renamed
!= to <>; ! is now only for impure functions.
- Renamed
~+ to ~mod+; added ~mod-, ~sat+ and ~sat-.
- Removed
&^.
- Renamed
$(etc) to [etc].
- Renamed
[i..j] to [i ..= j], consistent with Rust syntax.
- Renamed
[i:j] to [i .. j], consistent with Rust syntax.
- Renamed
x T to x: T, consistent with Rust syntax.
- Renamed
[N] T and [] T types to array[N] T and slice T.
- Renamed
while:label to while.label.
- Renamed
u32, buf1, etc to base.u32, base.io_buffer, etc.
- Renamed
unread_u8? to undo_byte!; added can_undo_byte.
- Renamed some
decode? methods to decode_io_writer?.
- Replaced
= try foo with =? foo.
- Prohibited effect-ful subexpressions.
- Redesigned iterate blocks.
- Added
{frame,image,pixel}_config and pixel_buffer types.
- Added a
reset method.
- Added
peek_uxx, skip_fast and write_fast_uxx methods.
- Renamed some
read_uxx methods as read_uxx_as_uyy.
- Report image metadata such as ICCP and XMP.
- Added I/O positions.
- Tweaked how I/O marks and limits work.
- Tweaked
io_buffer / io_reader distinction in C and Wuffs.
- Added extra fields (uninitialized internal buffers) to structs.
- Supported animated (not just single frame) and interlaced GIFs.
- Marked some internal status codes as private.
- Removed closed-for-read/write built-in status codes.
- Changed the string messages for built-in status codes.
- Changed
error "foo" to "#foo" or base."#bar".
- Added warnings as another status code category.
- Made the status type a
const char *, not an int32_t.
- Disallowed
__double_underscore prefixed names.
- Added fuzz tests.
- Added
WUFFS_CONFIG__MODULES.
- Added
WUFFS_CONFIG__STATIC_FUNCTIONS.
- Added some C++ convenience methods.
- Added some Go and Rust benchmarks.
- Made struct implementations private (opaque pointers).
- Sped up the
mimic_deflate_xxx benchmarks.
- Fix compile errors under MSVC (Microsoft Visual C/C++).
- Moved the base38 package from
lang/base38 to lib/base38.
- Added a stand-alone
lib/interval package.
- Added NIE file format spec.
- Added RAC file format spec and Go implementation.