mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-25 02:29:31 -06:00
Fuzzed inputs drove one check-one process to 2-6 GB (the 16 GB CI runner running two of them was killed every night). Three causes, each with a test: - lopdf (bootstrap inspector) sized PNG predictor rows from /Columns before reading data: /Columns 4294967295 allocated two 4 GiB rows. Vendored lopdf 0.45.0 refuses rows longer than the data (and uses saturating row widths); its load-time stream decoding also gets a 256 MiB limit (it had none). - hayro sized a tiling pattern's cell pixmap from /XStep x scale, bounded only by u16: a step far beyond /BBox allocated 2 GB. The vendored patch keeps the cell within 3000 px a side, lowering the resolution instead. - cos decoded cross-reference streams up to the general 1 GiB limit; they now stop at what 8,388,607 objects' rows can hold (~200 MB at most), and the section is reconstructed (logged) instead. On the nightly's seed (41) the worst captured input fell from 6.2 GB to 6 MB, and a 300 s fuzz run had no process above 300 MB (before: many at 2-5 GB). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
466 lines
8.6 KiB
TOML
466 lines
8.6 KiB
TOML
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
|
#
|
|
# When uploading crates to the registry Cargo will automatically
|
|
# "normalize" Cargo.toml files for maximal compatibility
|
|
# with all versions of Cargo and also rewrite `path` dependencies
|
|
# to registry (e.g., crates.io) dependencies.
|
|
#
|
|
# If you are reading this file be aware that the original Cargo.toml
|
|
# will likely look very different (and much more reasonable).
|
|
# See Cargo.toml.orig for the original contents.
|
|
|
|
[package]
|
|
edition = "2024"
|
|
rust-version = "1.88"
|
|
name = "lopdf"
|
|
version = "0.45.0"
|
|
authors = [
|
|
"Junfeng Liu <china.liujunfeng@gmail.com>",
|
|
"Emulator <emulator@hotmail.it>",
|
|
]
|
|
build = false
|
|
exclude = [
|
|
"/benches",
|
|
"/assets",
|
|
"/.chglog",
|
|
"/.vscode",
|
|
"/.github",
|
|
]
|
|
autolib = false
|
|
autobins = false
|
|
autoexamples = false
|
|
autotests = false
|
|
autobenches = false
|
|
description = "A Rust library for PDF document manipulation."
|
|
homepage = "https://github.com/J-F-Liu/lopdf"
|
|
documentation = "https://docs.rs/crate/lopdf/"
|
|
readme = "README.md"
|
|
keywords = [
|
|
"pdf",
|
|
"editing",
|
|
"manipulation",
|
|
"merge",
|
|
]
|
|
categories = ["text-processing"]
|
|
license = "MIT"
|
|
repository = "https://github.com/J-F-Liu/lopdf.git"
|
|
|
|
[badges.travis-ci]
|
|
repository = "J-F-Liu/lopdf"
|
|
|
|
[features]
|
|
async = [
|
|
"tokio/rt-multi-thread",
|
|
"tokio/macros",
|
|
]
|
|
chrono = ["dep:chrono"]
|
|
chrono-clock = [
|
|
"chrono",
|
|
"chrono/clock",
|
|
]
|
|
default = [
|
|
"chrono-clock",
|
|
"rayon",
|
|
]
|
|
embed_image = ["image"]
|
|
font_embedding = ["dep:skrifa"]
|
|
jiff = ["dep:jiff"]
|
|
serde = ["dep:serde"]
|
|
time = ["dep:time"]
|
|
wasm_js = ["getrandom/wasm_js"]
|
|
|
|
[lib]
|
|
name = "lopdf"
|
|
path = "src/lib.rs"
|
|
|
|
[[example]]
|
|
name = "add_barcode"
|
|
path = "examples/add_barcode.rs"
|
|
|
|
[[example]]
|
|
name = "analyze_object_streams"
|
|
path = "examples/analyze_object_streams.rs"
|
|
|
|
[[example]]
|
|
name = "analyze_page_contents"
|
|
path = "examples/analyze_page_contents.rs"
|
|
|
|
[[example]]
|
|
name = "analyze_pdf"
|
|
path = "examples/analyze_pdf.rs"
|
|
|
|
[[example]]
|
|
name = "analyze_references"
|
|
path = "examples/analyze_references.rs"
|
|
|
|
[[example]]
|
|
name = "check_raw_objstream"
|
|
path = "examples/check_raw_objstream.rs"
|
|
|
|
[[example]]
|
|
name = "compress_existing_pdf"
|
|
path = "examples/compress_existing_pdf.rs"
|
|
|
|
[[example]]
|
|
name = "create"
|
|
path = "examples/create.rs"
|
|
|
|
[[example]]
|
|
name = "create_text_heavy_pdf"
|
|
path = "examples/create_text_heavy_pdf.rs"
|
|
|
|
[[example]]
|
|
name = "debug_compression_detailed"
|
|
path = "examples/debug_compression_detailed.rs"
|
|
|
|
[[example]]
|
|
name = "debug_compression_full"
|
|
path = "examples/debug_compression_full.rs"
|
|
|
|
[[example]]
|
|
name = "debug_object_stream"
|
|
path = "examples/debug_object_stream.rs"
|
|
|
|
[[example]]
|
|
name = "debug_save_with_objstreams"
|
|
path = "examples/debug_save_with_objstreams.rs"
|
|
|
|
[[example]]
|
|
name = "decompression_bomb"
|
|
path = "examples/decompression_bomb.rs"
|
|
|
|
[[example]]
|
|
name = "decrypt"
|
|
path = "examples/decrypt.rs"
|
|
|
|
[[example]]
|
|
name = "delete_outlines"
|
|
path = "examples/delete_outlines.rs"
|
|
|
|
[[example]]
|
|
name = "encrypt"
|
|
path = "examples/encrypt.rs"
|
|
|
|
[[example]]
|
|
name = "extract_text"
|
|
path = "examples/extract_text.rs"
|
|
required-features = ["serde"]
|
|
|
|
[[example]]
|
|
name = "extract_toc"
|
|
path = "examples/extract_toc.rs"
|
|
required-features = ["serde"]
|
|
|
|
[[example]]
|
|
name = "final_compression_test"
|
|
path = "examples/final_compression_test.rs"
|
|
|
|
[[example]]
|
|
name = "inspect_object_stream"
|
|
path = "examples/inspect_object_stream.rs"
|
|
|
|
[[example]]
|
|
name = "merge"
|
|
path = "examples/merge.rs"
|
|
|
|
[[example]]
|
|
name = "object_streams"
|
|
path = "examples/object_streams.rs"
|
|
|
|
[[example]]
|
|
name = "print_annotations"
|
|
path = "examples/print_annotations.rs"
|
|
|
|
[[example]]
|
|
name = "replace_partial_text"
|
|
path = "examples/replace_partial_text.rs"
|
|
|
|
[[example]]
|
|
name = "rotate"
|
|
path = "examples/rotate.rs"
|
|
|
|
[[example]]
|
|
name = "test_better_compression"
|
|
path = "examples/test_better_compression.rs"
|
|
|
|
[[example]]
|
|
name = "test_decryption"
|
|
path = "examples/test_decryption.rs"
|
|
|
|
[[example]]
|
|
name = "test_direct_objstream"
|
|
path = "examples/test_direct_objstream.rs"
|
|
|
|
[[example]]
|
|
name = "test_filter_roundtrip"
|
|
path = "examples/test_filter_roundtrip.rs"
|
|
|
|
[[example]]
|
|
name = "test_metadata"
|
|
path = "examples/test_metadata.rs"
|
|
|
|
[[example]]
|
|
name = "test_object_stream_creation"
|
|
path = "examples/test_object_stream_creation.rs"
|
|
|
|
[[example]]
|
|
name = "test_object_stream_roundtrip"
|
|
path = "examples/test_object_stream_roundtrip.rs"
|
|
|
|
[[example]]
|
|
name = "test_real_pdf_compression_with_fix"
|
|
path = "examples/test_real_pdf_compression_with_fix.rs"
|
|
|
|
[[example]]
|
|
name = "test_structural_compression"
|
|
path = "examples/test_structural_compression.rs"
|
|
|
|
[[example]]
|
|
name = "verify_decryption"
|
|
path = "examples/verify_decryption.rs"
|
|
|
|
[[example]]
|
|
name = "verify_page_compression"
|
|
path = "examples/verify_page_compression.rs"
|
|
|
|
[[example]]
|
|
name = "verify_pdf"
|
|
path = "examples/verify_pdf.rs"
|
|
|
|
[[example]]
|
|
name = "verify_trailer_compression_fix"
|
|
path = "examples/verify_trailer_compression_fix.rs"
|
|
|
|
[[test]]
|
|
name = "annotation"
|
|
path = "tests/annotation.rs"
|
|
|
|
[[test]]
|
|
name = "brotli_decode"
|
|
path = "tests/brotli_decode.rs"
|
|
|
|
[[test]]
|
|
name = "catalog_compression_integration_test"
|
|
path = "tests/catalog_compression_integration_test.rs"
|
|
|
|
[[test]]
|
|
name = "decompression_bomb"
|
|
path = "tests/decompression_bomb.rs"
|
|
|
|
[[test]]
|
|
name = "decryption"
|
|
path = "tests/decryption.rs"
|
|
|
|
[[test]]
|
|
name = "document_load_performance"
|
|
path = "tests/document_load_performance.rs"
|
|
|
|
[[test]]
|
|
name = "encrypted_object_stream_test"
|
|
path = "tests/encrypted_object_stream_test.rs"
|
|
|
|
[[test]]
|
|
name = "extract_test"
|
|
path = "tests/extract_test.rs"
|
|
|
|
[[test]]
|
|
name = "font_test"
|
|
path = "tests/font_test.rs"
|
|
|
|
[[test]]
|
|
name = "incremental_document"
|
|
path = "tests/incremental_document.rs"
|
|
|
|
[[test]]
|
|
name = "linearized_objstm_test"
|
|
path = "tests/linearized_objstm_test.rs"
|
|
|
|
[[test]]
|
|
name = "load_options_test"
|
|
path = "tests/load_options_test.rs"
|
|
|
|
[[test]]
|
|
name = "metadata_test"
|
|
path = "tests/metadata_test.rs"
|
|
|
|
[[test]]
|
|
name = "modify"
|
|
path = "tests/modify.rs"
|
|
|
|
[[test]]
|
|
name = "object_stream_comprehensive_test"
|
|
path = "tests/object_stream_comprehensive_test.rs"
|
|
|
|
[[test]]
|
|
name = "object_stream_edge_cases_test"
|
|
path = "tests/object_stream_edge_cases_test.rs"
|
|
|
|
[[test]]
|
|
name = "object_stream_methods_test"
|
|
path = "tests/object_stream_methods_test.rs"
|
|
|
|
[[test]]
|
|
name = "object_stream_performance_test"
|
|
path = "tests/object_stream_performance_test.rs"
|
|
|
|
[[test]]
|
|
name = "page_content"
|
|
path = "tests/page_content.rs"
|
|
|
|
[[test]]
|
|
name = "save_options_xref_streams_test"
|
|
path = "tests/save_options_xref_streams_test.rs"
|
|
|
|
[[test]]
|
|
name = "simple_object_stream_test"
|
|
path = "tests/simple_object_stream_test.rs"
|
|
|
|
[[test]]
|
|
name = "stream_length_recovery"
|
|
path = "tests/stream_length_recovery.rs"
|
|
|
|
[[test]]
|
|
name = "trailer_reference_compression_test"
|
|
path = "tests/trailer_reference_compression_test.rs"
|
|
|
|
[[test]]
|
|
name = "unicode"
|
|
path = "tests/unicode.rs"
|
|
|
|
[[test]]
|
|
name = "utils"
|
|
path = "tests/utils.rs"
|
|
|
|
[[test]]
|
|
name = "xref_reconstruction"
|
|
path = "tests/xref_reconstruction.rs"
|
|
|
|
[[test]]
|
|
name = "xref_stream_bounds"
|
|
path = "tests/xref_stream_bounds.rs"
|
|
|
|
[dependencies.aes]
|
|
version = "0.9"
|
|
|
|
[dependencies.bitflags]
|
|
version = "2.13"
|
|
|
|
[dependencies.brotli-decompressor]
|
|
version = "5.0"
|
|
|
|
[dependencies.cbc]
|
|
version = "0.2"
|
|
|
|
[dependencies.chrono]
|
|
version = "0.4"
|
|
features = ["std"]
|
|
optional = true
|
|
default-features = false
|
|
|
|
[dependencies.ecb]
|
|
version = "0.2"
|
|
|
|
[dependencies.encoding_rs]
|
|
version = "0.8"
|
|
|
|
[dependencies.flate2]
|
|
version = "1.1"
|
|
|
|
[dependencies.getrandom]
|
|
version = "0.4"
|
|
|
|
[dependencies.image]
|
|
version = "0.25"
|
|
optional = true
|
|
|
|
[dependencies.indexmap]
|
|
version = "2.14"
|
|
|
|
[dependencies.itoa]
|
|
version = "1.0"
|
|
|
|
[dependencies.jiff]
|
|
version = "0.2"
|
|
optional = true
|
|
|
|
[dependencies.log]
|
|
version = "0.4"
|
|
|
|
[dependencies.md-5]
|
|
version = "0.11"
|
|
|
|
[dependencies.nom]
|
|
version = "8.0"
|
|
|
|
[dependencies.rand]
|
|
version = "0.10"
|
|
|
|
[dependencies.rangemap]
|
|
version = "1.7"
|
|
|
|
[dependencies.rayon]
|
|
version = "1.12"
|
|
optional = true
|
|
|
|
[dependencies.serde]
|
|
version = "1.0"
|
|
features = ["derive"]
|
|
optional = true
|
|
|
|
[dependencies.sha2]
|
|
version = "0.11"
|
|
|
|
[dependencies.skrifa]
|
|
version = "0.45.1"
|
|
optional = true
|
|
|
|
[dependencies.stringprep]
|
|
version = "0.1.5"
|
|
|
|
[dependencies.thiserror]
|
|
version = "2.0"
|
|
|
|
[dependencies.time]
|
|
version = "0.3"
|
|
features = [
|
|
"formatting",
|
|
"parsing",
|
|
]
|
|
optional = true
|
|
|
|
[dependencies.tokio]
|
|
version = "1"
|
|
features = [
|
|
"fs",
|
|
"io-util",
|
|
]
|
|
optional = true
|
|
|
|
[dependencies.weezl]
|
|
version = "0.2"
|
|
|
|
[dev-dependencies.clap]
|
|
version = "4.6"
|
|
features = ["derive"]
|
|
|
|
[dev-dependencies.env_logger]
|
|
version = "0.11"
|
|
|
|
[dev-dependencies.flate2]
|
|
version = "1.1"
|
|
|
|
[dev-dependencies.serde_json]
|
|
version = "1.0"
|
|
|
|
[dev-dependencies.shellexpand]
|
|
version = "3.1"
|
|
|
|
[dev-dependencies.tempfile]
|
|
version = "3.27"
|
|
|
|
[dev-dependencies.wasm-bindgen-test]
|
|
version = "0.3"
|
|
|
|
[target.'cfg(not(target_family="wasm"))'.dev-dependencies.criterion]
|
|
version = "0.8"
|