Skip to content

Fix ten more bugs from a second random sweep - #14026

Merged
niksedk merged 1 commit into
mainfrom
claude/bug-hunt-2026-08-23-round2
Aug 23, 2026
Merged

Fix ten more bugs from a second random sweep#14026
niksedk merged 1 commit into
mainfrom
claude/bug-hunt-2026-08-23-round2

Conversation

@niksedk

@niksedk niksedk commented Aug 23, 2026

Copy link
Copy Markdown
Member

Follow-up to #14025 — a second random sweep, different areas. Nine of the ten were reproduced with a failing test before the fix (regression tests in tests/libse/Core/BugHunt20260823Round2Test.cs, verified red against the pre-fix tree via git stash).

Crashes / data loss

  1. DVD Studio Pro "with space" readers threw on a valid file — the regex declares variable-width time codes (\d+) but the parsers cut fixed offsets (Substring(0, 25) / Substring(27)). 0:0:0:0 , 0:0:0:1 , Hi gave ArgumentOutOfRangeException. All four variants now split on the separator, which also stops a separator inside the text from truncating it.
  2. Csv silently dropped any line whose text contained ; — it split on every separator and required exactly 4 parts, so a 5-part line was skipped with no _errorCount. Round-tripping "Hello; world" through Csv lost the line. Now split with a limit of 4 (which also stops RemoveEmptyEntries from dropping an empty-text row).
  3. ASSA resampling silently gave up on \pos (10,11) — the regexes allow \s* but the offset math didn't, and the failure path was break, abandoning every remaining tag on the line. Parameters are now read between the parentheses, and a bad tag is skipped instead of aborting.
  4. WordsPerMinute returned Infinity — no zero-duration guard, unlike GetCharactersPerSecond directly below it. One zero-length line made the average and maximum WPM of a whole Statistics / batch-statistics report (a reversed line gave a negative rate). Same < 1 guard, same 999 sentinel.

Wrong or dead behaviour

  1. WebVTT thumbnails rejected every .jpeg sprite sheetLoadSubtitle only accepted .png/.jpg.
  2. The .jpeg branch of GetBitmap used posJpg (always -1 there) instead of posJpeg — masked by 5, and it would throw on a short name.
  3. Netflix "spell out leading number" was dead off Windows — the pattern hardcoded \r\n while paragraph text uses Environment.NewLine. It now captures the digits (removing the offset arithmetic entirely) and accepts either line break.
  4. Netflix max-line-length reported the same fix twice for a paragraph with two over-long lines — the fix re-breaks the whole paragraph, so the second record was a duplicate.
  5. Video OCR dropped unreadable frames out of their group — the comment said "treat as part of the current group" but continue skipped the EndFrame update, and EndFrame drives the subtitle's end time.
  6. ToRawAss had an unreachable duplicate strikeout branch (dead code; the correct branch 30 lines up already handles it). Also fixed alongside: CheckForErrors cut the untrimmed line after testing the trimmed one — same mismatch class as the ActorConverter bug in Fix ten bugs from a random sweep of libse/libuilogic #14025.

Note on test coverage: item 10's dead-branch removal has no behavioural test by definition; the included test instead pins that StrikeOut is written from the style rather than a constant.

Verification

  • libse 1445 passed, libuilogic 504 passed, seconv 383 passed, UI builds.
  • The 11 new tests were run against the pre-fix tree: 9 failed, confirming each repro.

🤖 Generated with Claude Code

The four "DVD Studio Pro with space" readers cut fixed offsets out of a
line whose regex declares variable-width time codes, so a valid file
threw ArgumentOutOfRangeException; they now split on the separator,
which also keeps a separator that appears inside the text. Csv had the
same shape: it split on every ";" and required exactly four parts, so
any line whose text contained a semicolon was dropped without an error -
even one Csv itself had written.

AssaResampler cut tag parameters at a fixed offset although its regexes
allow whitespace, so "\pos (10,11)" failed to parse and the "break" then
abandoned every remaining tag on the line.

Paragraph.WordsPerMinute had no zero-duration guard, unlike
GetCharactersPerSecond right below it, so one zero-length line made the
average and maximum WPM of a whole statistics report infinite.

WebVTT thumbnails rejected every .jpeg sprite sheet, and the .jpeg
branch of GetBitmap indexed with posJpg instead of posJpeg.

Netflix "spell out leading number" matched only "\r\n" so the rule was
dead off Windows; it now captures the digits and accepts either line
break. Netflix max-line-length logged the same fix once per over-long
line. Video OCR dropped unreadable frames out of their group instead of
extending it, shortening the subtitle. ToRawAss had an unreachable
duplicate "strikeout" branch, and ASSA CheckForErrors cut the untrimmed
line after testing the trimmed one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@niksedk
niksedk merged commit 5c88649 into main Aug 23, 2026
1 check passed
@niksedk
niksedk deleted the claude/bug-hunt-2026-08-23-round2 branch August 23, 2026 08:36
pull Bot pushed a commit to matrixer2306/subtitleedit that referenced this pull request Aug 24, 2026
SubtitleEdit#14042 merged into main between compiling the beta23 change-log and
merging the prep PR, so its three shipped-bug fixes were missing. Its
fourth fix (the ASSA CheckForErrors guard) is left out: that bug was
introduced by SubtitleEdit#14026 in this same beta and never shipped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant