Files
ghostty/pkg/wuffs/src/main.zig
Jeffrey C. Ollie ec55cbc879 wuffs: protect against crafted images that cause overflows
Fixes #9579

Protect against panics caused by integer overflows by using functions
that allow integer overflows to be caught instead of causing a panic.

Also protect against DOS from images that might not cause an
overflow but do consume an absurd amount of memory by limiting
images to a maximum size of 4GiB (which is the maximum size of
`image-storage-limit`).
2025-11-13 14:20:19 -06:00

21 lines
487 B
Zig

const std = @import("std");
pub const png = @import("png.zig");
pub const jpeg = @import("jpeg.zig");
pub const swizzle = @import("swizzle.zig");
pub const Error = @import("error.zig").Error;
/// The maximum image size, based on the 4G limit of Ghostty's
/// `image-storage-limit` config.
pub const maximum_image_size = 4 * 1024 * 1024 * 1024;
pub const ImageData = struct {
width: u32,
height: u32,
data: []u8,
};
test {
std.testing.refAllDeclsRecursive(@This());
}