{"answers":{"affected":"1 open source package ship an affected version, including latex-rust.","exploited":"There is no known exploitation of RUSTSEC-2026-0311 in the wild and no public exploit code.","fix":"Upgrade latex-rust to 1.0.5 or later.","what":"RUSTSEC-2026-0311 is a denial of service vulnerability in latex-rust, published on 27 Sep 2026. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for RUSTSEC-2026-0311 and fix it if it is affected.\n\nWhat it is: RUSTSEC-2026-0311 is a denial of service vulnerability in latex-rust, published on 27 Sep 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of RUSTSEC-2026-0311 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- latex-rust (crates.io): affected from 0.0.0-0; fixed in 1.0.5\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/RUSTSEC-2026-0311/ (Markdown: https://insights.sbomify.com/RUSTSEC-2026-0311/index.md)","id":"RUSTSEC-2026-0311","markdown":"https://insights.sbomify.com/RUSTSEC-2026-0311/index.md","name":"RUSTSEC-2026-0311","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"Rust LaTeX parser","requires_auth":"none","summary":"Attackers can crash applications using the latex-rust library by submitting deeply nested LaTeX input, causing a stack overflow and process abort.","user_interaction":"not_required","vuln_class":"denial_of_service"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"The parser and layout engine in affected versions of `latex-rust` recurse once\nper level of nesting with no limit. Deeply nested input, such as `\\frac{1}{…}`,\nbraces, `\\sqrt{…}`, `\\left(`, or superscripts nested hundreds or thousands of\nlevels deep, exhausts the call stack.\n\nA stack overflow in Rust aborts the process. It is not a panic, so it cannot be\ncaught with `catch_unwind`. A program that renders LaTeX from untrusted input\ncan therefore be terminated by a short string. With a release build on an 8 MiB\nstack, 700 nested `\\frac{1}{…}` (about 7 KB of input) abort version 1.0.4, and\n10,000 nested braces (about 20 KB) abort it as well. The threshold is lower on\nsmaller stacks and in debug builds; on a 2 MiB thread in a debug build, about\n35 nested fractions are enough.\n\n```rust\nlet mut src = String::from(\"1\");\nfor _ in 0..700 {\n    src = format!(\"\\\\frac{{1}}{{{src}}}\");\n}\nlet _ = latex_rust::parse(\u0026src); // stack overflow, process aborts\n```\n\nThe fixed versions count nesting depth in the parser and in `layout` and\nrefuse input that nests more than 32 levels. `parse`, `parse_with_colors`, and\nthe `latex_to_*` functions return\n`ParseError::Malformed(\"input nests deeper than 32 levels\")`, and `layout`\nreturns `Error::Unsupported { what: \"tree nests deeper than 32 levels\" }` for a\ntree built by hand. The count is of parser recursion levels, and a braced\nargument costs two, so the limit admits 15 nested `\\frac`, `\\sqrt`, or\n`x^{…}`, and 31 nested groups, `\\left…\\right` pairs, or environments. Input\npast the limit is refused within about 100 KiB of stack in an optimised build.\n\nVersion 1.0.5 fixes this with no API changes and is a drop-in replacement for\n1.0.4; upgrade with `cargo update -p latex-rust`. It also includes the 2.0.0\nrendering fixes, so rendered output differs from 1.0.4. Versions 2.0.0 and\n2.0.1 contain the same fix, with the same limit and messages, together with\nbreaking API changes relative to 1.x, and also let callers change the limit\nwith `ParseOptions` and `layout_with_max_depth`.","ecosystems":["crates.io"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Stack overflow on deeply nested LaTeX input","id":"RUSTSEC-2026-0311","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"denial_of_service","year":"2026"},"n_packages":1,"n_references":null,"packages":[{"ecosystem":"crates.io","fixed":["1.0.5"],"introduced":["0.0.0-0"],"last_affected":[],"package":"latex-rust","purl":"pkg:cargo/latex-rust","source":"RUSTSEC-2026-0311"}],"products":null,"published":"2026-09-27","related":[],"sources":[{"class":"open","licence":"CC0 1.0","name":"RustSec","prefix":"RUSTSEC"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can crash applications using the latex-rust library by submitting deeply nested LaTeX input, causing a stack overflow and process abort.","url":"https://insights.sbomify.com/RUSTSEC-2026-0311/"}