github Le-Syl21/exiftool-rs v0.9.0

4 hours ago

Faster to build and smaller, with no tag, value or group change on valid
files: the parity audit still reads 196 / 196 files identical to ExifTool
13.59. Six more fuzzing rounds (about seven hours over every supported
extension) found the cases listed under Fixed.

Changed

  • A release build of the crate takes about a third of the time it did, and
    the released Linux CLI is 40 % smaller (#13). Three generated modules — the
    print conversions, the 283 binary sub-tables and Sony's 59 ciphered
    tables — unrolled every table into code of its own, and that code was
    most of the build and of the binary. Their generators now write the
    tables as static data, read by a few lookup functions and two
    hand-written interpreters (tags::binary_tables,
    tags::sony_ciphered). Nothing moved behind a feature flag, and the
    output does not change: a dump of the test and fuzz corpora under 25
    option sets and 15 CLI modes, plus about ten million direct calls into
    the generated tables, is byte-identical before and after, and the parity
    audit still reads 196 / 196. Measured on an i7-8700K with -j 2, 0.8.2
    against this tree (CPU is user + system):

    0.8.2 Now
    Release build of the library and CLI, wall / CPU 180 s / 304 s 59 s / 105 s
    The library built as a dependency (Cargo's default release profile), wall / CPU 180 s / 294 s 56 s / 91 s
    Debug build of the library and CLI, wall / CPU 24 s / 31 s 14 s / 19 s
    Peak memory of the release build 2.56 GiB 1.37 GiB
    LLVM IR of the library (cargo llvm-lines) 3.43 M lines 1.39 M lines
    CLI binary, Linux x86-64, as released 27.1 MB 16.4 MB

    Of the 10.7 MB the binary loses, 6.2 MB is this change and 4.6 MB the
    stripped symbol table below.

  • Release builds strip the symbol table (strip = true), about a fifth of
    the binary. A panic still gives its file and line; backtraces lose their
    function names. The profile applies to builds of this repository only: a
    crate that depends on this one keeps its own.

  • CI builds the tests with LTO off. Under thin LTO every test executable
    repeated the library's whole optimisation at its own link; building them
    takes 50 s instead of 336 s on the machine above. The binaries CI ships
    are still built with thin LTO.

  • The published crate no longer carries tests/: Cargo never builds a
    dependency's tests, and ours need tests/images/, which was already left
    out. The download loses about 800 files.

  • Dependencies: brotli 9 (JPEG XL / JPEG 2000 brotli boxes), egui and
    eframe 0.36.2 (GUI only), thiserror 2.0.21, encoding_rs 0.8.42. The
    lockfile's encoding_rs needs Rust 1.88; a crate depending on this one
    resolves its own.

Fixed

  • PLIST (binary and XML) and XMP GContainer tags came out in a different
    order from one run to the next. They now follow the document, as in
    ExifTool.

Corrupt or hostile files could still panic, allocate gigabytes or take
seconds per kilobyte. Each case now returns, with a regression input under
tests/malformed/:

  • EXIF: an IFD0 SubIFDs list pointing back into IFD0 re-read it once per
    entry (110 KB in, 42 MB of tags and 1 GB of memory out). ExifTool skips
    such an offset as suspicious, and follows at most ten SubIFDs; both rules
    are now applied, with ExifTool's warnings.
  • Composite ThumbnailTIFF: the strip was padded to the declared
    StripByteCounts, so a 6 KB NEF asked for 4 GB. ExifTool drops the
    composite when the strip is not in the file; a strip longer than the
    file never is.
  • QuickTime: a constant-size stsz expanded its declared sample count
    (up to 16 GB).
  • Dates in MRC, QuickTime, gzip, AIFF and FLV were found by walking one
    year at a time; a timestamp billions of years away hung the reader. Whole
    400-year cycles are now skipped first, which gives the same dates.
  • JSON: nested arrays were copied at every level (quadratic on unmatched
    [); arrays deeper than 64 levels are skipped.
  • XMP: flattening a long struct field name was quadratic (1.4 s for 60 KB);
    the output is unchanged.
  • Allocations and bounds tests that could overflow on sizes read from the
    file: binary plist offset tables (also in macOS ._ sidecars), CZI
    metadata offsets, BigTIFF value offsets, RealMedia RJMD sub-directories,
    MRC OLE dates.
  • Text sliced inside a multi-byte character: PostScript comments, Internet
    shortcut (.URL) dates, plist dates, RED dates and times.

Install: cargo install exiftool-rs, or download a prebuilt, signed binary below.

Don't miss a new exiftool-rs release

NewReleases is sending notifications on new releases.