Repository navigation
Conversation
What changed: - tests/fuzz_support/mod.rs: seeds from every .tex under fixtures/ and crates/*/tests; per-case splitmix RNG (seed, index) so every finding replays; mutations: truncate, delete/duplicate brace/bracket/$/\begin/\end tokens, splice lines between files, 10k-deep nesting, 100k-char control sequence names, unbalanced \if/\fi, \def recursion, invalid \char code points, \input of itself. Each case runs compile_full_project (parse + layout) on an 8 MiB thread under catch_unwind with a watchdog; worker processes isolate stack overflows and hangs; ddmin minimiser. - examples/fuzz_compile.rs: supervisor, --replay, --check, --minimise, --diagnostics. - tests/fuzz_compile.rs: the same run as an #[ignore] test (debug build). What was run: - fuzz_compile --cases 300 --jobs 12: "fuzz: 300 cases, 4 unique findings" - FLASHTEX_FUZZ_CASES=40 cargo test --test fuzz_compile -- --ignored: "the fuzzer found 3 unique failures" (expected before the fixes) Next step: 50k-case run, minimise and fix each finding. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… u8 overflow What changed: - The per-kind and total list depths were `count() as u8 + 1` in push_list_frame and open_list: 255 enclosing lists panicked with "attempt to add with overflow" (fuzz finding). Depths now saturate (next_list_depths), and a \begin past LaTeX's \@toodeep limits (six \list levels; four itemize/enumerate) reports "LaTeX Error: Too deeply nested." while the list is still typeset. - enumitem start=<i64::MIN> no longer overflows `n - 1`. - Regression test in tests/robustness.rs. What was run: - cargo test --test robustness lists_nested (before the fix): "panicked at src/parser.rs:6972:26: attempt to add with overflow" - after: "test result: ok. 1 passed; 0 failed" Next step: remaining fuzz findings. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed:
- finish_math took an unclosed formula's end from the last content token.
When the content was re-read from earlier input (`\setlength{\begin{}$`)
that token lay before the `$`, so Span::in_document tripped
"span start must not exceed end" (debug) or produced an inverted span
(release). The end now comes only from the opener's document and never
precedes the opener's end.
- Regression test an_unclosed_math_span_never_inverts.
What was run:
- before: "panicked at src/lib.rs:60:9: span start must not exceed end"
- after: cargo test --test robustness: "test result: ok. 9 passed; 0 failed"
Next step: the cross-document alignment span.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… in one document
What changed:
- multirow_environment merged every cell token's span into the row span;
with `\begin{align}a\include{sub}` the cells hold tokens of sub.tex and
main.tex, tripping "cannot merge spans from different documents". Row
spans now merge only tokens of the environment's own document, and an
`\end{align}` found in another document no longer sets the display's
end offset (it could invert the span).
- Regression test an_alignment_that_inputs_another_document_keeps_its_spans_in_one_document.
What was run:
- before: "panicked at src/lib.rs:74:9: assertion `left == right` failed:
cannot merge spans from different documents"
- after: cargo test --test robustness: "test result: ok. 9 passed; 0 failed"
Next step: remaining fuzz findings (tex-expansion overflow, stack overflow, hangs).
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…flow What changed: - Fuzz finding: `\advance` added to a count holding i64::MAX (an over-long digit string parsed to i64::MAX) and panicked with "attempt to add with overflow" (expand.rs do_arith). - Constants follow tex.web §445: past 2^31-1 is "Number too big." and becomes 2147483647 (decimal, octal, hex; also the integer part of a dimen/glue, which silently became 0 before). - `<dimen>` past max_dimen is "Dimension too large." and becomes ±max_dimen (§448). - \advance and \multiply check the result against infinity / max_dimen; on overflow they report "Arithmetic overflow." and assign nothing (§1236-1240). - \numexpr/\dimexpr: saturating steps, and an out-of-range result is "Arithmetic overflow." with value 0 (e-TeX); rounded_div computes in i128. - `fil` followed by more than two further `l`s overflowed the u8 order; now "Illegal unit of measure (replaced by filll)." (§454). - Regression test numeric_ranges_follow_tex_instead_of_overflowing. What was run: - before: left "9223372036854775807" (and the add-overflow panic) - after: cargo test (tex-expansion): "test result: ok. 56 passed; 0 failed" (expand_tests), "ok. 3 passed" (incremental), "ok. 2 passed" (oracle) Next step: stack overflow and hang findings. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…e stack
What changed:
- Fuzz finding: a table cell, footnote, \colorbox/\rotatebox/\uline
argument or \include re-enters parse_stream on its own token stream
with no depth bound. 3000 nested tabulars overflowed an 8 MiB release
stack ("thread has overflowed its stack"), and 10k took minutes (every
level copies its cell tokens).
- parse_stream now counts its nesting; past STREAM_DEPTH_LIMIT = 255 it
reports "TeX capacity exceeded, sorry [grouping levels=255]." once per
compile and skips the content nested past the limit.
- fuzz_support: FLASHTEX_FUZZ_STACK_KB overrides the case stack size.
- Regression test nested_sub_parses_hit_tex_grouping_capacity_instead_of_the_stack
(debug frames are ~50 KiB per tabular level, so it runs on a 64 MiB thread).
What was run:
- before: "thread '<unknown>' has overflowed its stack / fatal runtime error"
- after: "test result: ok. 1 passed; 0 failed" (5.86s, debug)
- release --check at depth 255, 2 MiB stack: "signature: ok" (tabular, footnote)
Next step: hangs (\loop runaway, unknown-command suggestion cost).
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…x.web §339)
What changed:
- Fuzz finding (hang): `\loop{\n}` with no \repeat. The file ended while
\loop's argument was scanned; the expander reported the runaway but still
expanded the body with the partial argument, so \iterate ran until the
2M expansion-step limit, emitting "Extra \fi." (and, via the compiler,
one unknown-command diagnostic) per iteration: >2 minutes to compile.
- TeX sets long_state := outer_call there, so the inserted \par aborts the
call. report_file_ended_and_recover now sets the silent runaway flag
for Matching, and call_macro aborts.
- Regression test a_macro_call_cut_off_by_the_end_of_file_is_aborted.
What was run:
- before: diagnostics ["Runaway argument?...", "Extra \fi.", "Extra \fi.", ...]
- after: cargo test (tex-expansion): "ok. 57 passed; 0 failed" (expand_tests),
"ok. 3 passed" (incremental), "ok. 2 passed" (oracle)
Next step: the unknown-command suggestion cost behind the remaining hangs.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… cannot hang
What changed:
- Fuzz finding (hang): `\def\a{\n\a}\a` emits ~666k `\n` before the 2M
expansion-step limit. Each got an unknown-command diagnostic whose
did-you-mean scanned the whole vocabulary several times
(command_error -> closest_commands, command_help -> suggest_command,
is_known_command), allocating per candidate: 269 s in release.
- closest_commands is memoised per thread (bounded at 4096 names);
is_known_command is a HashSet lookup; candidates whose length differs by
more than the edit limit are skipped before edit_distance copies the name
(a 100k-character control sequence: 860 ms -> 6 ms).
- Regression test a_runaway_loop_of_unknown_commands_is_diagnosed_in_bounded_time.
What was run:
- release, before: "269114 ms, 1 pages, 666816 diagnostics"
- release, after: "1989 ms, 1 pages, 666816 diagnostics"
- debug test after: "test result: ok. 1 passed; 0 failed ... finished in 10.88s"
Next step: re-run the 50k fuzz on the fixed build.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…ty exceeded"
What changed:
- Fuzz finding (hang, 9 of 26 hangs in a 2000-case run):
`\def\a#1{\a{#1#1}}\a x` doubles its argument on every call, so the
token lists exhaust memory and time after ~30 calls while the 2M
expansion-step limit is nowhere near.
- call_macro sizes the substitution before building it; past the
output-token budget (Limits::max_output_tokens) it reports
"TeX capacity exceeded, sorry [main memory size=5000000]." and stops
expansion, as TeX does when main memory runs out.
- Regression test an_argument_that_doubles_every_call_exceeds_capacity.
What was run:
- before (release fuzz build, --check, 40 s watchdog): cases 1204 1196 1599
1849 567 894 393 941 1280 "signature: hang"
- after: all nine "signature: ok" in <= 1 s
- cargo test (tex-expansion): "ok. 58 passed; 0 failed" (expand_tests),
"ok. 3 passed" (incremental), "ok. 2 passed" (oracle)
Next step: the slow deep-nesting cases.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed:
- Reported from another lane: parsing
crates/page-builder/oracle/fixtures/vspace-03.tex panicked with
"span start must not exceed end" in required_group_bounded. Minimised:
`\AtBeginDocument{\setlength\}}` + `\begin{document`. The replayed
argument's closing offset lies before its `{`.
- One helper, P::span_through(open, end), now builds every
"opener through end offset" span (required_group_bounded, display math,
alignments, tabular, the delimited-argument reader): the end never
precedes the opener's end or runs past the opener's document.
- Regression test an_argument_replayed_from_at_begin_document_never_inverts_its_span
(minimised input plus the whole fixture).
What was run:
- before: "panicked at src/lib.rs:60:9: span start must not exceed end"
- after: "test result: ok. 1 passed; 0 failed"
Next step: \loop oracle fixtures parse time; slow deep-nesting cases.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…rash inputs What changed: - Seeds now include crates/*/oracle/**/*.tex (the page-builder oracle fixture vspace-03.tex panicked the parser and was not a seed). This changes which input each case index generates. - Up to 50 inputs per hang/crash signature are saved for triage (those signatures do not distinguish causes). What was run: - fuzz_compile --cases 2000: "fuzz: 2000 cases, 1 unique findings" (26 hangs, triaged) Next step: full 50k re-run on the fixed build. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…bug threads) What changed: - Measured after the previous commit: 255 nested tabulars still overflow a 512 KiB thread in release (128 already did; ~7 KiB a level) and a 2 MiB debug thread fails at 40 levels (~50 KiB a level), so the guard did not fire first on every profile. STREAM_DEPTH_LIMIT is now 32, like MAX_MATH_DEPTH; the error reads "TeX capacity exceeded, sorry [grouping levels=32]." - \include nesting keeps its own INCLUDE_DEPTH_LIMIT (64) and no longer counts toward the sub-parse depth. - The regression test runs on the default test thread again. What was run: - release fuzz build, FLASHTEX_FUZZ_STACK_KB=512, 3000 nested tabular / footnote: "signature: ok" (both) - cargo test --test robustness nested_sub_parses: "test result: ok. 1 passed" (0.28s) Next step: \left...\right nesting is quadratic in layout. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…not quadratic layout What changed: - Fuzz finding (slow compile, 15.7 s release for one input): sizing a \left/\right pair lays out all the atoms it encloses (left_right_stretch_scales), so 10k nested pairs cost depth x length. - The math parser counts open \left's; past MAX_LEFT_RIGHT_DEPTH = 32 it reports "TeX capacity exceeded, sorry [grouping levels=32]." once and drops the extra \left's and their \right's. Formulas within the limit are unchanged (left_right_nesting goldens pass). - Regression test deeply_nested_left_right_pairs_hit_a_capacity_limit_in_bounded_time. What was run: - before: fuzz case 529 "15664 ms, 2 pages, 17120 diagnostics" (release) - after: debug test with 10k nested pairs "ok. 1 passed ... finished in 0.13s" - cargo test --test left_right_nesting: "test result: ok. 3 passed; 0 failed" Next step: re-time the remaining slow fuzz cases. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…ot define
What changed:
- self_referential_macro_hits_explicit_recursion_limit used
`\newcommand{\loop}{\loop} \loop`. The prelude already defines \loop, so
\newcommand keeps `\loop#1\repeat`, whose argument runs to the end of
the file. It only reached the step limit through the bug fixed in
"tex-expansion: a macro call cut off by the end of file is aborted"; TeX
reports the runaway argument instead. The test now uses \recurse.
What was run:
- cargo test --manifest-path crates/compiler/Cargo.toml --no-fail-fast:
58 suites, 676 passed, 0 failed, 6 ignored
Next step: 50k fuzz re-run, PR.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed: - rustfmt on the new fuzz files and tests/robustness.rs (which was rustfmt-clean on main). No behaviour change. What was run: - cargo test --test robustness --test fuzz_compile: "test result: ok. 13 passed" and "ok. 0 passed; 0 failed; 1 ignored" Next step: PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…city exceeded"
What changed:
- Fuzz finding (36 GB resident, killed): `\def\a{\csname a\endcsna` +
10k `[` ... `]` + `me}\a`. `\csname a` re-enters \a before the rest
of its 20k-token body is read, so every call adds an input level holding
that body; memory ran out long before the 2M expansion-step limit.
- Pushing a token list now checks TeX's limits: 10000 input levels
("TeX capacity exceeded, sorry [input stack size=10000].", TeX Live's
stack_size) and, every 64 levels, the tokens still pending across all
levels against the output-token budget ("TeX capacity exceeded, sorry
[main memory size=5000000]."). Either stops expansion.
- Regression test a_non_tail_self_call_exceeds_capacity_instead_of_memory.
What was run:
- before: /usr/bin/time -l fuzz_compile --check case-14361: "36046176256
maximum resident set size", 80 s, killed (exit 137) in a second run
- after: "30 ms, 1 pages, 133 diagnostics", "172441600 maximum resident set size"
- cargo test (tex-expansion): "ok. 59 passed; 0 failed" (expand_tests),
"ok. 3 passed" (incremental), "ok. 2 passed" (oracle)
Next step: remaining slow cases; full compiler suite; PR.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…ry block What changed: - Fuzz finding (25.7 GB resident): 30k nested itemize. Every block clones the enclosing list frames, so memory was blocks x depth. - push_list_frame now stores no frame past LaTeX's limit (the one that reports "LaTeX Error: Too deeply nested."); it counts dropped levels, and a list \end pops a dropped level first. Blocks hold at most six frames; the dropped levels typeset at the deepest stored level. - lists_nested_past_255_levels_are_too_deeply_nested_not_an_overflow also checks that no block stores more than six frames. What was run: - before: fuzz case 12106 "4117 ms, 884 pages", "25687048192 maximum resident set size"; test: "a block stored 7 list frames" - after: "622 ms, 884 pages", "138084352 maximum resident set size"; test "ok. 1 passed" - cargo test --test list_structure --test setlist_spacing --test acceptance --test pinned_fixtures --lib: all "test result: ok" Next step: remaining slow fuzz cases. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed: - Fuzz finding (22 s): a mutated microtype oracle fixture whose \loop never ends. do_conditional (and a taken branch's \else) called line_of_span on every \if, counting newlines from the start of the file, for the "Incomplete \if...; all text was ignored after line N." message that only an unterminated conditional prints: quadratic in a runaway loop. - ScannerStatus::Skipping now carries the \if's span; the line is counted when that error is reported. The unused line count on a mismatched \end is gone. - Regression test conditionals_in_a_runaway_loop_do_not_rescan_the_source (also pins the "after line 3." wording). What was run: - before: test panicked "244.136504125s" (debug, 30 s budget) - after: "test result: ok. 1 passed ... finished in 0.53s"; tex-expansion cargo test: "ok. 60 passed" (expand_tests), "ok. 3 passed" (incremental), "ok. 2 passed" (oracle) Next step: re-time the remaining slow fuzz cases. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed:
- The new tex-expansion capacity stops ("TeX capacity exceeded, sorry
[input stack size=10000]." / "[main memory size=5000000].") end
expansion at a point that depends on where the run started. The
expansion cache only knew the step limit, so an incremental run could
stop elsewhere than a full one: expansion_incremental's random-edit test
diverged at step 198 ("tokens differ at 60356 (cached 60356 vs full
60386 tokens)"). The rest of the document was also dropped instead of
typeset unexpanded, and the recovery note said "continued expanding".
- step_limit_hit (cache fallback, unexpanded resume) and recovery_for now
treat both stops alike.
- Regression test a_capacity_stop_is_recovered_like_the_step_limit.
What was run:
- before: expansion_incremental FAILED as above; robustness test: left
Some("continued expanding after the problem")
- after: cargo test --test expansion_incremental: "ok. 2 passed; 0 failed";
cargo test --test robustness a_capacity_stop: "ok. 1 passed"
Next step: full compiler suite, final fuzz run, PR.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed: - tex-expansion: an identical diagnostic (severity, message, span) is recorded once between safe points; the set is emptied when next_content_token returns at a safe point, which is where incremental checkpoints are taken, so restored engines decide exactly as a full run. - tex-expansion: "group nesting limit exceeded" / "conditional nesting limit exceeded" are reported once per excursion (flags in checkpointed State). - tex-expansion: \end compares @Currenvir part by part without rebuilding the name; environment names longer than 100 characters are shortened in messages only. - compiler: diagnostics::limit_repeats drops identical repeats and keeps 1000 distinct diagnostics per code, then one "further N similar diagnostics suppressed" summary per code; fatal stops are always kept. Applied to the parser's list and to the layout's list, identically in clean and incremental compiles. - compiler: unsupported / unsupported_preamble skip building a repeat of a command already reported at the same span. - fuzz harness: per-case diagnostic count and time, max diagnostics and slowest case in the report; example --diagnostics prints the most frequent messages; --digest hashes pages and diagnostics of every seed. - tests: diagnostic_floods.rs (child process per case, peak heap via a counting allocator, watchdog), engine excursion/dedupe/long-name tests, incremental equivalence with repeats and nesting limits, warm-vs-fresh JSON identity with bounded diagnostics. What was run: - cargo test --manifest-path crates/tex-expansion/Cargo.toml: test result: ok. 63 passed; 0 failed (expand_tests), test result: ok. 4 passed; 0 failed (incremental_tests), test result: ok. 2 passed; 0 failed (oracle_tests) - cargo test --manifest-path crates/compiler/Cargo.toml --no-fail-fast: 59 suites, 684 passed, 0 failed, 6 ignored - fuzz_compile --cases 50000 --jobs 6 --seed 0xF1A57E40 (overflow checks, debug assertions): 0 panics, 0 overflows, 14 hangs (base 18); max diagnostics in one case 3109 (base 2974694) - fuzz_compile --digest over 419 seeds: pages identical for all 419; diagnostics differ in 49 (48 \loop fixtures ~14750 -> ~134, and 20-Vmatrix 3 -> 2, a duplicate glyph note) Next step: merge the updated compiler-fuzz branch and open the PR stacked on #577. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…no diagnostic What changed: - `\advance` on count, dimen and skip registers (value, stretch and shrink) adds with explicit i32 wrapping (tex.web §1238-1239 has no range check) instead of reporting "Arithmetic overflow." and leaving the register. `\multiply`, `\divide`, `\numexpr` and `\dimexpr` keep their bounds checks. - numeric_ranges_follow_tex_instead_of_overflowing pins pdfTeX's wrapped values with no diagnostic. What was run: - pdftex 3.141592653-2.6-1.40.29 (TeX Live 2026), plain and -etex: \count0=2147483647 \advance\count0 by 1 \showthe\count0 -> -2147483648 \count0=-2147483647 \advance\count0 by -2 -> 2147483647 \dimen0=\maxdimen \advance\dimen0 by 1sp \showthe\dimen0 -> 16384.0pt \dimen0=16383pt \advance\dimen0 by 16383pt -> 32766.0pt 3x\maxdimen -> -16384.00005pt; 4x\maxdimen+1sp -> -0.00005pt skip \maxdimen plus \maxdimen minus 1pt, advanced by the same minus 2pt -> 32767.99997pt plus 32767.99997pt minus 3.0pt - cargo test -p flashtex-tex-expansion --test expand_tests: test result: ok. 60 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Next step: reword or raise the grouping-level capacity limit (#577 review). Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed: merged origin/agent/daniel-parent/compiler-fuzz 0c1524c (no rebase), per the coordinator. What was run: see the next checkpoint. Next step: re-run suites on the merge. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…s where pdflatex does
What changed:
- STREAM_DEPTH_LIMIT stays 32 (255 nested tabulars, footnotes or rotateboxes
overflow a 512 KiB release and a 2 MiB debug thread), and its error now
says "FlashTeX nesting limit (32) exceeded" instead of claiming TeX's
"grouping levels" capacity.
- MAX_LEFT_RIGHT_DEPTH rises from 32 to 253 (TEX_GROUPING_LEVELS - 2), with
"TeX capacity exceeded, sorry [grouping levels=255].": pdflatex accepts 253
nested \left in a document's $$ or $ math and stops at the 254th.
The \left counter is not recursive, so the stack is not the bound.
What was run:
- pdflatex (TeX Live 2026), \documentclass{article}\begin{document}$$...$$:
252 ok, 253 ok, 254 and 255 "! TeX capacity exceeded, sorry [grouping levels=255]."
inline $...$: 253 ok, 254 capacity exceeded.
- Scratch probe (not committed) with both limits at 255:
release, 512 KiB thread: tabular/footnote/rotatebox 255 -> stack overflow;
colorbox/uline 255 ok; \left 255 ok (also on 256 KiB), 10000 in 120 ms
debug, 2 MiB thread: tabular/footnote/colorbox/rotatebox/uline 255 -> stack overflow;
\left 255 ok (also on 512 KiB), 10000 in 714 ms
- cargo test -p flashtex-compiler --test robustness:
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 36.36s
Next step: full compiler and tex-expansion suites and a 5k fuzz smoke run.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…flood-cap What changed: merged origin/agent/daniel-parent/compiler-fuzz d5d308e (no rebase), per the coordinator. What was run: full compiler and tex-expansion suites on the merge (see the PR). Next step: open the PR stacked on #577. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
daniel-parent independent review (subagent) Verdict: APPROVE Built the worktree at head 9aa0a29 (
Not independently reproduced: the release-build before/after memory (MB) and millisecond numbers in the PR's fuzz tables (would require checking out the pre-#577 base and re-running the same fuzz cases in release mode side by side — out of scope for the time budget here). The debug-build bounds those numbers are meant to generalize from ( No correctness issues found. The design (dedupe key = severity+message+span, safe-point-scoped, per-code budget with a fatal-stop carve-out, pure post-processing function for the compiler side) is sound and the tests substantiate the stated behavior. The one thing worth a maintainer's eyes, already flagged by the author: the 1000-per-code constant (point 5) is a real, if unlikely, place where a normal document could lose individual diagnostics — reasonable as shipped, easy to bump later if a real corpus needs it. |
|
Landed via #610 ( GitHub could not auto-close this because #610 was squash-merged, so this branch's tip is not an ancestor of main even though its content is. Verified present on main before closing:
Worth recording why this was closed rather than re-merged: an integration lane attempted to include these branches and found that doing so would have regressed main — their heads still carry the older fuzz tooling (no — orchestrator-astra (Commander) |
Stacked on #577 (
agent/daniel-parent/compiler-fuzz). Review after it; the diff against main includes #577 until that merges.What
This handles the three follow-ups in #577's "Not done": diagnostic floods, repeated nesting-limit reports, and 100k-character environment names.
1. Diagnostic floods. Every runaway flood the fuzzer found repeats the same diagnostic at one invocation span. So the fix is mainly dedupe, with a per-code budget as a backstop.
Engine::report):next_content_tokenempties the set when it returns at a safe point. Incremental checkpoints are taken only there, and a re-run converges only there, so a restored engine (whose set starts empty) decides exactly as a full run.diagnostics::limit_repeats, a pure function of the list):further N similar diagnostics suppresseddiagnostic for that code. It has the code, the most severe suppressed severity, and the first suppressed span, and is appended after the kept diagnostics.unsupportedandunsupported_preambledon't build a repeat of a command already reported at the same span.limit_repeatswould drop it anyway, but building 1.4M of them was the remaining cost.The dedupe key includes the message, not just (code, span). A macro invocation that uses two different unknown commands reports both at the invocation span with the same code, and (code, span) alone would hide the second. In the fuzz floods the difference is 82 vs 102 distinct diagnostics.
2. Nesting limits. "group nesting limit exceeded" and "conditional nesting limit exceeded" are reported once per excursion past the limit. A flag in the checkpointed
State(compared on convergence) is set on the report and cleared when a{or\ifis accepted again. The limits and wording are unchanged.3. Long environment names.
\endchecks@currenvirpart by part instead of rebuilding the name as a String on every\end. Environment names longer than 100 characters are cut to 100 characters plus...in the engine's messages only. Matching still uses the whole name.Fuzz harness:
--diagnostics FILEalso prints the most frequent messages.--digestcompiles every seed unmutated and prints hashes of its pages and diagnostics, to diff two builds.Why
A flood cost more than the loop that caused it. A mutated microtype fixture produced 3.8M diagnostics (4.9 GB), and the IDE would receive all of them. Each report is still useful once. TeX itself gives up after 100 errors in a paragraph.
Before → after (release, same flags,
fuzz_compile --diagnostics,/usr/bin/time -lmax RSS)\loop)\end)\def\a{\n\a}\a\def\a{\section{\a}}\ain the preamble\def\a{\bgroup\a}\a\def\b{\iftrue\b}\bIn 18502 the remaining memory is the 4.3M expanded tokens and 827 pages the loop produces. The remaining time in 10082 is two full 2M-step runs (see Not done).
Fuzz, 50k cases, seed 0xF1A57E40, 5 s watchdog, release with overflow checks and debug assertions, 6 jobs (base and this branch concurrently)
The hangs share one signature and are slow compiles of deep-nesting and recursion mutations under the watchdog with 12 fuzz processes on a shared machine (first case 8307). The same cases hang on the base. The 3,109 in case 2473 are distinct diagnostics across several codes, within the per-code budget.
Normal documents
fixture_digestis not on this base, sofuzz_compile --digestcompared every seed (419.texunderfixtures/,crates/*/tests,crates/*/oracle) between #577's head and this branch:\looporacle fixtures (microtype, paragraph-layout emergency): about 14,750 → about 134. These were the per-iteration repeats of the same unsupported commands.amsmath_corpus/20-Vmatrix.tex: 3 → 2. A secondTimes-Roman has no glyph for '‖'note identical to the first (same span) was dropped.Overlap check
gh pr list --state open --search diagnostic: render-pipeline: carry the compiler's diagnostic code through the display list #370, render-pipeline: preserve the compiler's diagnostic codes through the display conversion #275, render-pipeline: opt-in display-list-v2-diagnostics capability carries suggestion on the v2 wire #358 and mac: consume display-list-v2-diagnostics — v2 suggestions reach Problems and Tab-to-fix (after #358) #363 carry diagnostic codes or suggestions through render-pipeline or v2. compiler: \index / \glossary error instead of being silently discarded (#566) #570, compiler: \fnsymbol{footnote} inside \footnote errors (#564) #572 and compiler: diagnose the LaTeX pdflatex refuses instead of compiling it silently #365 add individual diagnostics. None touch expansion,limit_repeatsor the engine's reporting.coord.py claims:GH-DIAG-FLOOD-CAPclaimed by daniel-parent.GH-V2-DIAGNOSTICS-REBASE(daniel-parent) is the render-pipeline wire format, a different area.compiler-fuzzbranch rather than rebasing. The\advanceoverflow code and the nesting-limit constants are not touched here.vendor/is untouched.Test results
On the merge head 9aa0a29 (#577 through d5d308e merged in):
cargo test --manifest-path crates/tex-expansion/Cargo.toml:test result: ok. 63 passed; 0 failed(expand_tests),ok. 4 passed; 0 failed(incremental_tests),ok. 2 passed; 0 failed(oracle_tests)cargo test --manifest-path crates/compiler/Cargo.toml --no-fail-fast: 59 suites, 684 passed, 0 failed, 6 ignored. Among them:diagnostic_floods:test result: ok. 5 passed; 0 failedrobustness:ok. 14 passed; 0 failedexpansion_incremental:ok. 3 passed; 0 failedincremental_json_identity:ok. 6 passed; 0 faileddiagnostic_floodsagainst compiler: mutation fuzzer + 13 robustness fixes (panics, stack overflows, hangs, OOM) #577's head: all 5 fail. Measured in the debug test build, before → after:incremental_matches_full_with_repeated_diagnostics_and_nesting_limitsandincremental_matches_full_on_hw_fixturesfail with "diagnostics differ".\advancewrapping and the sub-parse/\leftlimits.Not done
IncrementalExpanderwould remove the second run.max_group_depth/max_conditional_depth4,IncrementalExpanderand a full run give different tokens after such an edit, and the base shows the same mismatch (seed 3, edit 54). The compiler already re-expands from scratch after a stop, so this is not visible there.diagnostics.rsif review wants another value.🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz