mirror of
https://github.com/storytold/craft-libs.git
synced 2026-10-31 15:49:54 +00:00
hayro-postscript 0.1.0 is the token scanner hayro-cmap uses for the CMap streams PDFs embed. Its object reader skipped each `<<` or `>>` by calling itself again, so a stream holding a long run of `<` or `>` bytes recursed once per pair and aborted the process with a stack overflow. Vendor the crates.io package unchanged and patch `object::read` to skip those runs in a loop, returning the same next object as before. Wire it in like the other Hayro crates: workspace exclude, [patch.crates-io] entry, SOURCE.json with registry and local hashes, the backend test script, NOTICE, ATTRIBUTION.md and the reader README. Tests cover a million `<` and a million `>` bytes, `<< /A 1 >>` and nested `<<<< /X >>>>` runs.
19 lines
1.0 KiB
Bash
19 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
# Run transferred backend tests with the complete local patch set. Test copies
|
|
# keep Cargo's standalone lock resolution from modifying the vendored source.
|
|
set -euo pipefail
|
|
root=$(cd "$(dirname "$0")/.." && pwd)
|
|
test_root=$(mktemp -d "${TMPDIR:-/tmp}/craft-pdf-backends.XXXXXX")
|
|
trap 'rm -rf "$test_root"' EXIT
|
|
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$root/target}"
|
|
patches=()
|
|
for backend in hayro hayro-interpret hayro-syntax hayro-jbig2 hayro-cmap hayro-postscript; do
|
|
cp -R "$root/vendor/$backend" "$test_root/$backend"
|
|
patches+=(--config "patch.crates-io.$backend.path=\"$test_root/$backend\"")
|
|
done
|
|
for backend in hayro-syntax hayro-interpret hayro hayro-jbig2 hayro-cmap hayro-postscript; do
|
|
cargo test --manifest-path "$test_root/$backend/Cargo.toml" --lib "${patches[@]}"
|
|
done
|
|
cargo test --manifest-path "$test_root/hayro-syntax/Cargo.toml" --doc "${patches[@]}"
|
|
cargo test --manifest-path "$test_root/hayro-syntax/Cargo.toml" --lib --no-default-features --features std "${patches[@]}"
|