`zeroed` and `refill_zeroed` filled each image buffer with
`par_extend(repeat_n(0u8, len))`, which has no minimum piece length.
When workers stole from each other, rayon kept splitting the buffer,
and on a pool with 128 or more workers the nested splits overflowed a
worker's 2 MiB stack. The fax page test
`a_blank_fax_page_wider_than_4096_px_passes_the_bomb_guard` aborted
this way on a 192-core host.
Both functions now call `extend_zeros`, which sets `with_min_len` to
1 MiB. A unit test zeroes 64 MiB on a pool of 256 workers with 256 KiB
stacks; without the change it aborts with a stack overflow.
deflate_band compresses a band into a buffer reserved at its worst case,
about 1.125 times the band's filtered bytes, and every band is held until
the bands are joined into one zlib stream. Each band kept that whole
buffer, so encoding a large image held about 1.125 times the image's size
in reserved capacity on top of the compressed output. The band's buffer
is now shrunk to the bytes it holds once the single deflate call has
finished.
On a 31404 x 31403 RGB image (2.96 GB) encoded with the fast setting,
peak resident memory during encode drops from 7.69 GiB to 6.48 GiB.
truncated_metadata_never_panics_and_falls_back passed its 50,000
repeated " tiff:ResolutionUnit>" decoys only when xmp_resolution
returned within 2 s. The search lives in craft-metadata, where
repeated_property_text_is_searched_once_for_each_property counts the
bytes it reads. This test now checks that the decoys give no
resolution, and keeps its clean-packet check.
Boundary tests set by a production constant check a small limit through a
private seam that takes it (b64 decode, drawingml table normalize, openpgp
verify), with the real constant nightly; captions and jbig2 check their
full-size boundaries nightly. Sweeps run every divisor-th case at the gate
(develop balanced highlights and thin line, jpeg low-memory tokens, png
streamed rows, mxf extreme fields, pdf crypt proptests), the fax bomb guard
page is wider and shorter, the resample bound pulls a shorter block, the nef
measured frames are read through probe_info, and local tone compares 64 and
256 pixels.
has_unretained_source_data fell through to Ok(false) for a valid file
whose codec the build leaves out (Netpbm without pnm, EXR, DICOM and
others). It now returns the same Unsupported error naming the feature
as decode and encode, and the left-out-formats test covers it.
Tests that loop over several formats now gate only the WebP, OpenEXR
and Netpbm entries, so their PNG, JPEG and TIFF cases also run without
those features.
Every codec dispatched by decode_as_with and encode was linked into any
binary that calls them, so a program reading PNG and JPEG also carried
OpenEXR, WebP, the JPEG XL encoder and a dozen rarer codecs.
Each of those now sits behind a default Cargo feature: dds, dicom, dpx,
exr, fits, iff, jpegls, jxl-encode, pnm, tga, webp and xpm. The default
build is unchanged. With a feature off its codec, its dependency (exr,
image-webp, zune-jpegxl, the image crate's TGA decoder) and its
format-specific functions are not compiled in; the format is still
detected, caps reports it neither readable nor writable, and decoding,
encoding or probing it returns CodecError::Unsupported naming the
feature. SGI and Sun Raster now give that same named reason.
The DICOM, Cineon and IFF signature checks and the JPEG-LS marker walk
are what detect() and PrefixDetector use, so they now live beside them.
The codec modules call them from there. No behaviour change.
This lets a later change compile those codecs out while detection stays.
The PNG writer copied the caller's ICC profile, and the exported EXIF,
into new buffers before writing the header. Each tagged save allocated a
second profile-sized buffer that could abort the process when memory ran
short. The header now borrows the profile, and borrows the EXIF whenever
export_exif returns it unchanged.