Repository navigation
Conversation
libFuzzer under ASan and UBSan (tests/fuzz, scripts/fuzz.sh, weekly in .github/workflows/fuzz.yml), with the browser-only code built in. It found, and the engine fixes (all but one also in chdman 0.289): a Huffman tree's lookup table written past its end and left partly unset, a map size computed in 32 bits, maps longer than the file allocated first, map bit widths over 32, CD codec sector data and LaserDisc frames longer than their hunk, CD metadata read with %s into 16-byte buffers or missing a track, old-style CD metadata read past its end, a 0-byte read that read a whole hunk, hunks naming a codec or a parent the CHD doesn't have, and undefined behavior with unchanged results. Also: a header with a hunk or unit size of 0, or more hunks than a map counts, is an error. Default CHDs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
CSO/ZSO, PBP, ECM, zip and CloneCD files cut short, with fields set to extremes and bytes changed: each ends as a card that says why, or a conversion that finishes or fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
…eset on phones A conversion the page hears nothing from for 90 s while visible gets a note that it may be stuck, until it goes on (DEBUG.freeze and stallMs for tests). On phones and tablets the compression hint suggests Nearly as small, faster; the default stays chdman's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
browsers.yml runs the suite with EXTRA_BROWSERS against the native references; bench.yml times the page in Chromium and Firefox (Ubuntu) and WebKit (an Apple-silicon Mac). bench.js takes --browser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
In Playwright's WebKit the engine-failure message is Safari's own advice, DAT files aren't kept across a reload (no navigator.storage), and the tests of storage that fails as a run starts have nothing to fail, so they skip there as the other storage tests do. The macOS runner for WebKit's benchmark was cancelled before any runner took it: Ubuntu instead, against native chdman. bench.js gave native extracts after the first thread count no throughput. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
…here its results go The check (Store.init) runs when the page opens and wasn't waited for, so a job started before it was done kept its results in memory, and could ask the memory question for nothing. Firefox's check can take longer on a busy machine than the engine takes to load: CI's Firefox run lost one test to it. Jobs and Advanced tab commands now wait for it (Store.ready); DEBUG.storeDelay slows it for the test that shows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
Firefox's tab crashes when a worker is terminated while it instantiates the engine. A helper that fails to start stops the job at once, while the other helpers are still starting: the tab crashed every time in the Firefox tests (fallbacks.spec.js, "a helper thread that fails to start"). Every role now says 'wasm-ready' once instantiated, and the page terminates workers only through Engine.stop, which waits for that (or for 'fatal', or 10 s). The job worker instantiates before it copies its inputs, so a cancel while it copies isn't held up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
CI's fuzzing, its first run without a cached corpus, found it: the bit reader's remove(32) shifted its 32-bit buffer by 32, which C++ leaves undefined (UBSan reports it). On x86 and in WebAssembly the shift count is masked, so the buffer kept its bits and the next field read them again. Only a crafted map reaches it: a real CHD would need 2^31 hunks or parent units for a 32-bit field. chdman 0.289 has it. remove() now empties the buffer for 32 bits; fewer, as every real CHD reads, is unchanged. The input is tests/fuzz/regressions/chd/map-bits-32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
…ext visit
Once a reload or close has begun, WebKit fails a worker's reads of the
picked files before the page is gone ("The I/O read operation failed").
The job then ended as an error, which cleared its record, so the next
visit didn't say that a conversion didn't finish (recovery.spec.js in
WebKit, 1 in 4 runs on the wider-window branch, whose faster engine
reads sooner).
Once beforeunload has been seen, a job that fails keeps its record and
the record goes only if the page is still here 3 s later, running
nothing newer (the visitor chose to stay).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
Once a reload has begun, WebKit fails the job worker's reads of the
picked files and logs each, as a console error or an uncaught error
("... due to access control checks."). The two tests that reload during a
conversion now accept exactly that in WebKit; the note they check for is
what the page's fix (the record kept) makes them pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
Just after identification ends, a card can be redrawn (seen 5 ms after app.settled returned, once in six runs): a click then reaches no button, and the card stays ready, as tests (firefox) found on 07d3d61 (fallbacks, the ECM image copied first). app.run clicks again if the card is still ready 3 s later; a page that ignores the button still fails. CLAUDE.md: Recovery.ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
Now and then Playwright's Firefox never delivers a folder picked through the chooser: no change event, and setFiles never returns. A plain page with only a folder input shows it too (1 run in 200), more under CI's load, where a folder test then waited until the test timeout (tests (firefox) on 758a592: edge-cases "a cue sheet added later..."). app.addFolder, now used by every folder test, watches the chooser's input for its change event and chooses the folder once more if none comes within 10 s; a late first delivery would be a duplicate, which the page ignores. Firefox: 135 runs of the folder tests and the whole project (353) pass; a delivery dropped on purpose is chosen again in Chromium, Firefox and WebKit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1 of milestone 8 (docs/chd/fork-plan.md): make the engine and the page's own file readers safe on damaged and crafted input, and say when a job stops making progress; step 2's measuring in CI. Default CHDs are unchanged: byte for byte the same as chdman 0.289's.
Fuzzing
tests/fuzz/andscripts/fuzz.sh: four libFuzzer targets under ASan and UBSan, with the engine built with__EMSCRIPTEN__defined so the browser-only code is fuzzed too (the read-ahead of extract and verify, the helpers' decompression, identification's probe functions, the ECM decoder).tests/fuzz/host.cppdoes what the page's JavaScript does for the engine: it runs chdman commands as the job worker does and answers the hunks they read ahead in four ways (no helpers, all, failing one in three, reversed), and aborts if chdman pauses with nothing to wait for (a hang in the browser).chd: a CHD file, read as identification does, theninfo,verifyand every extract command.desc: a cue sheet, TOC, GDI, NRG or ISO, parsed, then made into a CHD, verified and extracted again.codec: one compressed hunk for each codec.ecm: ECM chunks rebuilt a window at a time.seeds.cppmakes the seeds with the engine itself (v3 and v4 CHDs by hand); each finding is kept intests/fuzz/regressions/, which every run replays..github/workflows/fuzz.yml: weekly 30 minutes per fuzzer, 5 whenengine/,wasm/or the fuzzers change; the corpus is kept in the Actions cache (pruned to what adds coverage), and a finding is uploaded.What it found, fixed in the engine
All but one are in unmodified chdman 0.289 too;
engine.spec.jscompares with upstream where a fixture can show it (upstream: SIGSEGV, SIGFPE or "stack smashing detected").huffhunk or a v5 map. And the table's entries no code covers were never set.chd/map-bits-32).%sinto 16-byte buffers; CD metadata missing a track (0-byte sectors, a division by zero inextractcd); old-styleCHCDmetadata read past its end.The page
tests/ui/readers.spec.js: damaged CSO/ZSO, PBP, ECM, zip and CloneCD files (cut short, fields set to extremes, bytes changed) each end as a card that says why or a conversion that finishes or fails, never an uncaught error or a card left waiting. Not changed here: a damaged file stored in a zip converts, since stored files are read in place and only deflated ones are checked against the zip's CRC-32.Engine.run's watchdog; a line in the Advanced tab).wasm-readyonce instantiated, and the page terminates workers only throughEngine.stop, which waits for that (or 10 s). The job worker instantiates before copying its inputs, so a cancel during the copy isn't held up.Store.ready, which jobs and Advanced tab commands now wait for).beforeunloadhas been seen, a job that fails keeps its record, which goes only if the page is still there 3 s later (Recovery.ended). The two tests that reload during a conversion accept WebKit's log of that cut-off read.CI
.github/workflows/browsers.yml: the suite in Firefox and WebKit (EXTRA_BROWSERS), against the native references. In WebKit the tests follow the browser: the engine-failure message is Safari's own advice, DATs aren't kept across a reload and the tests of storage that fails as a run starts skip (Playwright's WebKit has nonavigator.storage, as for the other storage tests)..github/workflows/bench.yml:bench.js(now--browser) in Chromium, Firefox and WebKit on Ubuntu, against native chdman; the tables are the run's summary. (A macOS runner for WebKit was cancelled before any runner took it.)Checks
REQUIRE_NATIVE=1full suite (Chromium projects): 463 passed, 13 skipped (the usual skips), against unmodified chdman 0.289 and the native engineengine.spec.json the sanitized build (ASan, LSan, UBSan): 43 passedscripts/fuzz.sh check allon every seed, regression and corpus input: no findings; eight rounds of 20–25 minutes per fuzzer, each finding fixed before the nextscripts/check-dist.sh,check-licenses.sh,engine-diff.sh --check: pass🤖 Generated with Claude Code
https://claude.ai/code/session_01QUSh6AFtA1CAR66DNvjtty