fix(deps): 23 known vulnerabilities closed; the XLSX reader keeps & in a cell
The first run of cargo-deny on the lock file (2026-11-09) listed 23 RustSec advisories, one unsound crate and two yanked ones. This closes all but two by upgrading; the two are a second copy of quick-xml that typst brings and that reads nothing from outside (the gate's file, next commit, says so with its reason and date). A wrong answer found on the way. quick-xml 0.42 reports a character or entity reference (`&`, `&`) as an event of its own, where 0.38 handed it over inside the text. The reader's first build on 0.42 took only the text events, so a cell holding `AT&T` read as `ATT`: a payee's name, changed without a word, on its way into an import. The reader now turns each reference into its character (the five XML names, decimal and hexadecimal numbers) in shared strings and in inline cell text, and refuses a file whose reference names no character rather than dropping it. Two new tests: a reference in a cell is its character; a reference to no character is refused. What moved, and the advisory each closes: - quick-xml 0.38 -> 0.42 in ledger-reader, the copy that parses files from outside (RUSTSEC-2026-0194, -0195: a slow or memory-hungry parse of hostile XML). - rusqlite 0.32 -> 0.41, with `fallible_uint` so a u64 past i64::MAX is an error and never a wrapped number (libsqlite3-sys, RUSTSEC-2026-0459). One test's use of `column_names` follows the new signature. - rust_xlsxwriter 0.90 -> 0.102, which drops the old zip 4 (RUSTSEC-2026-0367, -0368, -0369, -0429). - In the lock file only: rustls (-0346 to -0349), rustls-webpki (-0382), webpki-root-certs (-0383), ctutils (-0385), tokio (-0386), zstd, zstd-safe and zstd-sys (-0391, -0398, -0403, -0410), pulldown-cmark (-0433), rmcp 3.5 -> 3.9 (-0457, -0461, -0462), and the yanked async-executor and clipboard-win. - fuzz/Cargo.lock in step, so the fuzz targets build what ships. No new dependency of ours: rsqlite-vfs and sqlite-wasm-rs enter the lock file as rusqlite's own, for a target (wasm) we do not build. Shown: `cargo check --workspace --all-targets` clean; `cargo test` of ledger-reader (4 passed), ledger-import (145 passed, 2 ignored) and ledger-store (579 passed, 2 ignored, exit 0). The store run kept its scratch files in memory (TMPDIR on tmpfs): on the loaded disk a synced write took 30 ms and the refusal law alone ran past half an hour. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
7359d700d9
commit
9ad6f89816
8 files changed
+214
-180
No files matched your search
Generated
+64
-85
@@ -292,15 +292,6 @@ dependencies = [
|
||||
"object",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed"
|
||||
dependencies = [
|
||||
"derive_arbitrary",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arboard"
|
||||
version = "3.6.1"
|
||||
@@ -386,9 +377,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-executor"
|
||||
version = "1.14.0"
|
||||
version = "1.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a"
|
||||
checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37"
|
||||
dependencies = [
|
||||
"async-task",
|
||||
"concurrent-queue",
|
||||
@@ -1148,9 +1139,9 @@ checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486"
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "5.4.1"
|
||||
version = "5.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4"
|
||||
checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a"
|
||||
dependencies = [
|
||||
"error-code",
|
||||
]
|
||||
@@ -1496,9 +1487,9 @@ checksum = "8fd9f3db6f2cfef61c10613071955154ffdc9e515daebff26de4b54e35038fdd"
|
||||
|
||||
[[package]]
|
||||
name = "ctutils"
|
||||
version = "0.4.3"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574"
|
||||
checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f"
|
||||
dependencies = [
|
||||
"cmov",
|
||||
]
|
||||
@@ -1598,17 +1589,6 @@ version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
|
||||
|
||||
[[package]]
|
||||
name = "derive_arbitrary"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deunicode"
|
||||
version = "1.6.0"
|
||||
@@ -2787,15 +2767,6 @@ dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.1"
|
||||
@@ -2820,11 +2791,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.9.1"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
|
||||
checksum = "a596f1b20ed2cc5ecac41a164aaebc7258057060f06c0cf7a2ba3991ee7990fb"
|
||||
dependencies = [
|
||||
"hashbrown 0.14.5",
|
||||
"hashbrown 0.17.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3942,7 +3913,7 @@ dependencies = [
|
||||
"sha2 0.10.9",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"zip 9.0.2",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4009,7 +3980,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"zeroize",
|
||||
"zip 9.0.2",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4054,7 +4025,7 @@ dependencies = [
|
||||
"typst-as-lib",
|
||||
"typst-layout",
|
||||
"typst-pdf",
|
||||
"zip 9.0.2",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4104,7 +4075,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"toml 1.1.8+spec-1.1.0",
|
||||
"zip 9.0.2",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4114,9 +4085,9 @@ dependencies = [
|
||||
"hayro 0.8.0",
|
||||
"hayro-interpret 0.8.0",
|
||||
"kurbo",
|
||||
"quick-xml 0.38.4",
|
||||
"quick-xml 0.42.0",
|
||||
"thiserror 2.0.21",
|
||||
"zip 9.0.2",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4201,9 +4172,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.30.1"
|
||||
version = "0.39.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
|
||||
checksum = "14a5f01b87b92705d07b433c06f96cbc764637d81a0bffb5734ce17cf0f9a2b3"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
@@ -5567,9 +5538,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.13.5"
|
||||
version = "0.13.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "278e9268c93b9e498a2da46c34d90ba93a3255eb99009646398f34bc73ab36eb"
|
||||
checksum = "3db2be46835f013dd3f4fa7f5f7402c537787b54ebb6fe2b94bbdd7e2669bb7b"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"memchr",
|
||||
@@ -6070,9 +6041,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rmcp"
|
||||
version = "3.5.1"
|
||||
version = "3.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5023804cbe0304cbe06197ac16e645a0a0d0ffa2953bf735c15c2fa0213350"
|
||||
checksum = "d24a7e92f4bcaa36b97fa93c4fa7ca8f3e669eced949345b3462dba333c7f909"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.23.1",
|
||||
@@ -6083,6 +6054,7 @@ dependencies = [
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"indexmap",
|
||||
"libc",
|
||||
"pastey",
|
||||
"pin-project-lite",
|
||||
"rand 0.10.3",
|
||||
@@ -6091,6 +6063,7 @@ dependencies = [
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.0",
|
||||
"sse-stream",
|
||||
"thiserror 2.0.21",
|
||||
"tokio",
|
||||
@@ -6103,9 +6076,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rmcp-macros"
|
||||
version = "3.5.1"
|
||||
version = "3.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1da498700030856ba63114bceefa30ba21f5e278cb975e5b9de3529fe842b40"
|
||||
checksum = "b3140f24a766f80f9ec1607bde85680959a69b83d46fa9ce87dadab7e67ab029"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
@@ -6170,6 +6143,15 @@ dependencies = [
|
||||
"lru",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rsqlite-vfs"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "353b74f9810d5b085b6c42c9d86a5f0fdb795553235cdd48753b32e3809d18a7"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rtoolbox"
|
||||
version = "0.0.6"
|
||||
@@ -6182,9 +6164,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.32.1"
|
||||
version = "0.41.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e"
|
||||
checksum = "da9bba6f3506135e120a6586df05be18b48d18896600646a4bec8f993d91a594"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"fallible-iterator",
|
||||
@@ -6192,6 +6174,7 @@ dependencies = [
|
||||
"hashlink",
|
||||
"libsqlite3-sys",
|
||||
"smallvec",
|
||||
"sqlite-wasm-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6213,11 +6196,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust_xlsxwriter"
|
||||
version = "0.90.2"
|
||||
version = "0.102.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2be778223b36bb449b2ef2df4856ced2d311680818a7310db5c5dc370170f935"
|
||||
checksum = "6ca3d0e879a578c1313c2800ab0c6c029d38eed18098675e50341a30d32372ed"
|
||||
dependencies = [
|
||||
"zip 4.6.1",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6280,9 +6263,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.45"
|
||||
version = "0.23.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
|
||||
checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
|
||||
dependencies = [
|
||||
"aws-lc-rs",
|
||||
"once_cell",
|
||||
@@ -6343,9 +6326,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.103.15"
|
||||
version = "0.103.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
|
||||
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
|
||||
dependencies = [
|
||||
"aws-lc-rs",
|
||||
"ring",
|
||||
@@ -6872,6 +6855,16 @@ dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlite-wasm-rs"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36bd8e29bf08189a005b2df1df99823aa0861cabe9044e5f31ed54ca292ee618"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"rsqlite-vfs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sse-stream"
|
||||
version = "0.2.6"
|
||||
@@ -7247,9 +7240,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.53.2"
|
||||
version = "1.54.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044"
|
||||
checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
@@ -8558,9 +8551,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki-root-certs"
|
||||
version = "1.0.9"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b"
|
||||
checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
@@ -9471,20 +9464,6 @@ dependencies = [
|
||||
"syn 3.0.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "4.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "9.0.2"
|
||||
@@ -9539,27 +9518,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "057cfd910cfac363a0ada849592624b4c9ff2e10bef504c3433810d78ed96f93"
|
||||
checksum = "db3ae9bf90af6e40197bef767eeefc46ad6397420fe873830bd85e5fbbfb3c70"
|
||||
dependencies = [
|
||||
"zstd-safe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-safe"
|
||||
version = "8.1.0"
|
||||
version = "8.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdd44c6a7284e91f3717755b24315a302edd9153a01f753c3cba3d765e8eafac"
|
||||
checksum = "ded520f16b29e1a9b771c722221b2b0a0398c2316d9bb3c42b458a5414d7434b"
|
||||
dependencies = [
|
||||
"zstd-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-sys"
|
||||
version = "2.1.1+zstd.1.5.7"
|
||||
version = "2.1.2+zstd.1.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aeec9eaf2dffbbd09201e23bd0ffcbaa33bb8e9266a10734fd7ed90a85eca078"
|
||||
checksum = "481ada9c543b2323cbb7bbdbb5249177fbf0188ed959ed2c15e4b22421c84ed3"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
|
||||
@@ -32,7 +32,7 @@ jsonschema = { version = "0.58", default-features = false }
|
||||
libc = "0.2"
|
||||
proptest = "1"
|
||||
reqwest = "0.13"
|
||||
rusqlite = { version = "0.32", features = ["bundled"] }
|
||||
rusqlite = { version = "0.41", features = ["bundled", "fallible_uint"] }
|
||||
rust_decimal = "1"
|
||||
rmcp = { version = "3", features = ["client", "transport-streamable-http-client-reqwest"] }
|
||||
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
|
||||
|
||||
@@ -11,7 +11,7 @@ rust_decimal = "1"
|
||||
chrono = "0.4"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
thiserror = "2"
|
||||
rust_xlsxwriter = "0.90"
|
||||
rust_xlsxwriter = "0.102"
|
||||
typst-as-lib = { version = "0.17", default-features = false }
|
||||
typst-pdf = "0.15.1"
|
||||
typst = "0.15.1"
|
||||
|
||||
@@ -17,7 +17,7 @@ hayro = { version = "0.8", features = ["embed-fonts"] }
|
||||
hayro-interpret = "0.8"
|
||||
kurbo = "0.13"
|
||||
zip = { version = "9.0.1", default-features = false, features = ["deflate"] }
|
||||
quick-xml = "0.38"
|
||||
quick-xml = "0.42"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -494,29 +494,59 @@ fn read_zip(zip: &mut zip::ZipArchive<Cursor<&[u8]>>, name: &str) -> Option<Stri
|
||||
Some(String::from_utf8_lossy(&bytes).into_owned())
|
||||
}
|
||||
|
||||
/// What a reference in a cell's text stands for: `&` is `&`, `é`
|
||||
/// is `é`. The parser hands a reference over as its own event, apart from
|
||||
/// the text around it, so a reader that skipped it would turn `AT&T`
|
||||
/// into `ATT`. A name that is none of XML's five is kept as it was written:
|
||||
/// a workbook has no DTD to define another.
|
||||
fn reference_text(r: &quick_xml::events::BytesRef<'_>) -> Result<String, ExtractError> {
|
||||
if let Some(c) = r
|
||||
.resolve_char_ref()
|
||||
.map_err(|e| ExtractError::Xlsx(e.to_string()))?
|
||||
{
|
||||
return Ok(c.to_string());
|
||||
}
|
||||
let name: &str = r;
|
||||
Ok(match quick_xml::escape::resolve_predefined_entity(name) {
|
||||
Some(text) => text.to_owned(),
|
||||
None => format!("&{name};"),
|
||||
})
|
||||
}
|
||||
|
||||
/// The text of each `<si>` in `xl/sharedStrings.xml`, rich-text runs
|
||||
/// concatenated.
|
||||
fn shared_strings(xml: &str) -> Result<Vec<String>, ExtractError> {
|
||||
use quick_xml::events::Event;
|
||||
let mut reader = quick_xml::Reader::from_str(xml);
|
||||
let mut out = Vec::new();
|
||||
let mut current: Option<String> = None;
|
||||
let mut in_text = false;
|
||||
loop {
|
||||
match reader.read_event() {
|
||||
Ok(quick_xml::events::Event::Start(e)) if e.name().as_ref() == b"si" => {
|
||||
Ok(Event::Start(e)) if e.name().as_ref() == "si" => {
|
||||
current = Some(String::new());
|
||||
}
|
||||
Ok(quick_xml::events::Event::End(e)) if e.name().as_ref() == b"si" => {
|
||||
Ok(Event::End(e)) if e.name().as_ref() == "si" => {
|
||||
out.push(current.take().unwrap_or_default());
|
||||
}
|
||||
Ok(quick_xml::events::Event::Start(e)) if e.name().as_ref() == b"t" => in_text = true,
|
||||
Ok(quick_xml::events::Event::End(e)) if e.name().as_ref() == b"t" => in_text = false,
|
||||
Ok(quick_xml::events::Event::Text(t)) if in_text => {
|
||||
Ok(Event::Start(e)) if e.name().as_ref() == "t" => in_text = true,
|
||||
Ok(Event::End(e)) if e.name().as_ref() == "t" => in_text = false,
|
||||
Ok(Event::Text(t)) if in_text => {
|
||||
if let Some(s) = &mut current {
|
||||
s.push_str(&t.decode().map_err(|e| ExtractError::Xlsx(e.to_string()))?);
|
||||
s.push_str(&t.xml10_content());
|
||||
}
|
||||
}
|
||||
Ok(quick_xml::events::Event::Eof) => break,
|
||||
Ok(Event::CData(t)) if in_text => {
|
||||
if let Some(s) = &mut current {
|
||||
s.push_str(&t.xml10_content());
|
||||
}
|
||||
}
|
||||
Ok(Event::GeneralRef(r)) if in_text => {
|
||||
if let Some(s) = &mut current {
|
||||
s.push_str(&reference_text(&r)?);
|
||||
}
|
||||
}
|
||||
Ok(Event::Eof) => break,
|
||||
Ok(_) => {}
|
||||
Err(e) => return Err(ExtractError::Xlsx(e.to_string())),
|
||||
}
|
||||
@@ -537,30 +567,32 @@ fn sheet_cells(xml: &str, shared: &[String]) -> Result<String, ExtractError> {
|
||||
let mut inline = String::new();
|
||||
let mut in_inline_text = false;
|
||||
loop {
|
||||
// The text this event adds to the cell being read, if any.
|
||||
let mut text: Option<String> = None;
|
||||
match reader.read_event() {
|
||||
Ok(Event::Start(e)) => match e.name().as_ref() {
|
||||
b"row" => row = Vec::new(),
|
||||
b"c" => {
|
||||
"row" => row = Vec::new(),
|
||||
"c" => {
|
||||
cell_type.clear();
|
||||
value.clear();
|
||||
inline.clear();
|
||||
for a in e.attributes().flatten() {
|
||||
if a.key.as_ref() == b"t" {
|
||||
cell_type = String::from_utf8_lossy(&a.value).into_owned();
|
||||
if a.key.as_ref() == "t" {
|
||||
cell_type = a.value.into_owned();
|
||||
}
|
||||
}
|
||||
}
|
||||
b"v" => {
|
||||
"v" => {
|
||||
in_value = true;
|
||||
value.clear();
|
||||
}
|
||||
b"is" => in_inline = true,
|
||||
b"t" if in_inline => in_inline_text = true,
|
||||
"is" => in_inline = true,
|
||||
"t" if in_inline => in_inline_text = true,
|
||||
_ => {}
|
||||
},
|
||||
Ok(Event::End(e)) => match e.name().as_ref() {
|
||||
b"row" => rows.push(std::mem::take(&mut row)),
|
||||
b"c" => {
|
||||
"row" => rows.push(std::mem::take(&mut row)),
|
||||
"c" => {
|
||||
let text = match cell_type.as_str() {
|
||||
"s" => value
|
||||
.parse::<usize>()
|
||||
@@ -576,23 +608,25 @@ fn sheet_cells(xml: &str, shared: &[String]) -> Result<String, ExtractError> {
|
||||
};
|
||||
row.push(text);
|
||||
}
|
||||
b"v" => in_value = false,
|
||||
b"is" => in_inline = false,
|
||||
b"t" if in_inline => in_inline_text = false,
|
||||
"v" => in_value = false,
|
||||
"is" => in_inline = false,
|
||||
"t" if in_inline => in_inline_text = false,
|
||||
_ => {}
|
||||
},
|
||||
Ok(Event::Text(t)) => {
|
||||
let text = t.decode().map_err(|e| ExtractError::Xlsx(e.to_string()))?;
|
||||
if in_inline_text {
|
||||
inline.push_str(&text);
|
||||
} else if in_value {
|
||||
value.push_str(&text);
|
||||
}
|
||||
}
|
||||
Ok(Event::Text(t)) => text = Some(t.xml10_content().into_owned()),
|
||||
Ok(Event::CData(t)) => text = Some(t.xml10_content().into_owned()),
|
||||
Ok(Event::GeneralRef(r)) => text = Some(reference_text(&r)?),
|
||||
Ok(Event::Eof) => break,
|
||||
Ok(_) => {}
|
||||
Err(e) => return Err(ExtractError::Xlsx(e.to_string())),
|
||||
}
|
||||
if let Some(text) = text {
|
||||
if in_inline_text {
|
||||
inline.push_str(&text);
|
||||
} else if in_value {
|
||||
value.push_str(&text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(rows
|
||||
.iter()
|
||||
@@ -622,4 +656,39 @@ mod tests {
|
||||
));
|
||||
assert!(text_of(&bytes, "text/plain", "big.txt").is_none());
|
||||
}
|
||||
|
||||
/// A reference in a cell is its character, not a gap: `AT&T` reads
|
||||
/// `AT&T`. The parser reports each reference as its own event, and a
|
||||
/// reader that took only the text events would return `ATT` (it did,
|
||||
/// from quick-xml 0.38 until this test).
|
||||
#[test]
|
||||
fn a_reference_in_a_cell_is_its_character() {
|
||||
let shared = shared_strings(
|
||||
"<sst><si><t>AT&T</t></si>\
|
||||
<si><r><t>café </t></r><r><t><3> "x" 'y' A</t></r></si>\
|
||||
<si><t> kept</t></si></sst>",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(shared, ["AT&T", "café <3> \"x\" 'y' A", " kept"]);
|
||||
|
||||
let cells = sheet_cells(
|
||||
"<worksheet><sheetData><row>\
|
||||
<c t=\"s\"><v>0</v></c>\
|
||||
<c t=\"inlineStr\"><is><t>R&D</t></is></c>\
|
||||
<c t=\"str\"><v>a<b</v></c>\
|
||||
<c><v>12.50</v></c>\
|
||||
<c t=\"b\"><v>1</v></c>\
|
||||
</row></sheetData></worksheet>",
|
||||
&shared,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(cells, "AT&T\tR&D\ta<b\t12.50\tTRUE");
|
||||
}
|
||||
|
||||
/// A character reference that names no character is refused, not
|
||||
/// dropped.
|
||||
#[test]
|
||||
fn a_reference_to_no_character_is_refused() {
|
||||
assert!(shared_strings("<sst><si><t>�</t></si></sst>").is_err());
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ ledger-core = { path = "../ledger-core" }
|
||||
# must be callable here rather than only from the server. It is pure and
|
||||
# deterministic (no I/O, no network, no time source).
|
||||
ledger-reader = { path = "../ledger-reader" }
|
||||
rusqlite = { version = "0.32", features = ["bundled"] }
|
||||
rusqlite = { version = "0.41", features = ["bundled", "fallible_uint"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
chrono = "0.4"
|
||||
|
||||
@@ -3629,7 +3629,7 @@ fn projection_but_names(dir: &std::path::Path) -> Vec<(String, Vec<String>)> {
|
||||
.into_iter()
|
||||
.map(|t| {
|
||||
let mut stmt = conn.prepare(&format!("SELECT * FROM \"{t}\"")).unwrap();
|
||||
let names: Vec<String> = stmt.column_names().iter().map(|c| c.to_string()).collect();
|
||||
let names: Vec<String> = stmt.column_names().map(str::to_string).collect();
|
||||
let mut rows: Vec<String> = stmt
|
||||
.query_map([], |r| {
|
||||
Ok((0..names.len())
|
||||
|
||||
Generated
+49
-63
@@ -30,18 +30,6 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.5"
|
||||
@@ -734,9 +722,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ctutils"
|
||||
version = "0.4.3"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574"
|
||||
checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f"
|
||||
dependencies = [
|
||||
"cmov",
|
||||
]
|
||||
@@ -1265,7 +1253,7 @@ checksum = "d99fc21d493812643aae86d53b7bbd02f376434a90317e8a790bc209fdd6605e"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"foldhash",
|
||||
"hashbrown 0.17.1",
|
||||
"hashbrown",
|
||||
"log",
|
||||
"peniko",
|
||||
"png",
|
||||
@@ -1282,7 +1270,7 @@ checksum = "9f1218dedd5348c1b166ec3b8b3cbca49d2f527bd43b3fa072ea5123c523ed3f"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"foldhash",
|
||||
"hashbrown 0.17.1",
|
||||
"hashbrown",
|
||||
"log",
|
||||
"peniko",
|
||||
"png",
|
||||
@@ -1311,15 +1299,6 @@ dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.17.1"
|
||||
@@ -1331,11 +1310,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.9.1"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
|
||||
checksum = "a596f1b20ed2cc5ecac41a164aaebc7258057060f06c0cf7a2ba3991ee7990fb"
|
||||
dependencies = [
|
||||
"hashbrown 0.14.5",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1945,7 +1924,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.17.1",
|
||||
"hashbrown",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_core",
|
||||
@@ -2211,7 +2190,7 @@ dependencies = [
|
||||
"ledger-vault",
|
||||
"rust_decimal",
|
||||
"serde_json",
|
||||
"zip 9.1.3",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2221,9 +2200,9 @@ dependencies = [
|
||||
"hayro 0.8.0",
|
||||
"hayro-interpret 0.8.0",
|
||||
"kurbo",
|
||||
"quick-xml 0.38.4",
|
||||
"quick-xml 0.42.0",
|
||||
"thiserror",
|
||||
"zip 9.1.3",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2301,9 +2280,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.30.1"
|
||||
version = "0.39.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
|
||||
checksum = "14a5f01b87b92705d07b433c06f96cbc764637d81a0bffb5734ce17cf0f9a2b3"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
@@ -3131,9 +3110,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rmcp"
|
||||
version = "3.8.0"
|
||||
version = "3.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8be15815186873ea063bf005011d16c356804973489e40c39116ae3a2878d1f"
|
||||
checksum = "d24a7e92f4bcaa36b97fa93c4fa7ca8f3e669eced949345b3462dba333c7f909"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.23.1",
|
||||
@@ -3152,6 +3131,7 @@ dependencies = [
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.1",
|
||||
"sse-stream",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
@@ -3164,9 +3144,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rmcp-macros"
|
||||
version = "3.8.0"
|
||||
version = "3.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b0748e054a5f5598b3213cf72099ae6b2745ba4d996c59ccf455150a7dbb839"
|
||||
checksum = "b3140f24a766f80f9ec1607bde85680959a69b83d46fa9ce87dadab7e67ab029"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
@@ -3197,10 +3177,19 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.32.1"
|
||||
name = "rsqlite-vfs"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e"
|
||||
checksum = "353b74f9810d5b085b6c42c9d86a5f0fdb795553235cdd48753b32e3809d18a7"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.41.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da9bba6f3506135e120a6586df05be18b48d18896600646a4bec8f993d91a594"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"fallible-iterator",
|
||||
@@ -3208,6 +3197,7 @@ dependencies = [
|
||||
"hashlink",
|
||||
"libsqlite3-sys",
|
||||
"smallvec",
|
||||
"sqlite-wasm-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3229,11 +3219,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust_xlsxwriter"
|
||||
version = "0.90.2"
|
||||
version = "0.102.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2be778223b36bb449b2ef2df4856ced2d311680818a7310db5c5dc370170f935"
|
||||
checksum = "6ca3d0e879a578c1313c2800ab0c6c029d38eed18098675e50341a30d32372ed"
|
||||
dependencies = [
|
||||
"zip 4.6.1",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3577,6 +3567,16 @@ version = "0.9.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e"
|
||||
|
||||
[[package]]
|
||||
name = "sqlite-wasm-rs"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36bd8e29bf08189a005b2df1df99823aa0861cabe9044e5f31ed54ca292ee618"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"rsqlite-vfs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sse-stream"
|
||||
version = "0.2.6"
|
||||
@@ -3740,7 +3740,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom 0.4.3",
|
||||
"getrandom 0.3.4",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
@@ -4622,7 +4622,7 @@ dependencies = [
|
||||
"bytemuck",
|
||||
"fearless_simd 0.4.1",
|
||||
"guillotiere",
|
||||
"hashbrown 0.17.1",
|
||||
"hashbrown",
|
||||
"log",
|
||||
"peniko",
|
||||
"png",
|
||||
@@ -4639,7 +4639,7 @@ dependencies = [
|
||||
"bytemuck",
|
||||
"fearless_simd 0.4.1",
|
||||
"guillotiere",
|
||||
"hashbrown 0.17.1",
|
||||
"hashbrown",
|
||||
"log",
|
||||
"peniko",
|
||||
"png",
|
||||
@@ -4671,7 +4671,7 @@ checksum = "6d8ded630e8316bb94a55881256506d1f3b9947b5f66db8a7d32ca7ba02decd0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"glifo 0.1.1",
|
||||
"hashbrown 0.17.1",
|
||||
"hashbrown",
|
||||
"png",
|
||||
"vello_common 0.0.8",
|
||||
]
|
||||
@@ -4684,7 +4684,7 @@ checksum = "ed1fec424fbba6acf6cbc78bb526447eb77590d95f40419d598870fe37535212"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"glifo 0.4.0",
|
||||
"hashbrown 0.17.1",
|
||||
"hashbrown",
|
||||
"png",
|
||||
"vello_common 0.3.0",
|
||||
]
|
||||
@@ -5075,20 +5075,6 @@ dependencies = [
|
||||
"syn 3.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "4.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "9.1.3"
|
||||
|
||||
Reference in new issue
Block a user