Skip to content

fix: Keep saves from dropping bytes they still claim - #119

Merged
decriptor merged 2 commits into
mainfrom
fix/review-main-saves
Nov 18, 2026
Merged

decriptor merged 2 commits into
mainfrom
fix/review-main-saves

Conversation

@decriptor

Copy link
Copy Markdown
Owner

Summary

Fixes the save and read holes found on main at 851b03f.

  • An in-place Matroska SeekPosition or cue update refreshes that element's CRC-32 before the parent CRC.
  • Setting a Matroska value updates the tag the getter returns and keeps its SORT_WITH, default flag, and the other languages of that name.
  • SaveToFile() with no filesystem writes through the filesystem the file was read with. The same fallback is on the Matroska, MP3, FLAC, MP4, Ogg Vorbis, Ogg Opus, DSF, DFF, AIFF, and WAV writers.
  • A WAV sample reload that comes back short fails and does not write. A data chunk bigger than Array.MaxLength returns that same failure instead of throwing.
  • A RIFF size of 0xFFFFFFFF is read through to the end of the stream.
  • MediaFile.Read(Stream) returns a failure when the stream is too large to load, matching Read(string).

Test plan

  • Nested Seek and cue CRCs stay valid after a cluster move
  • Setting a Matroska title keeps SORT_WITH and a non-default language
  • Parameterless Matroska and MP3 saves write the filesystem from the read
  • A short WAV sample reload does not write
  • A LIST chunk past a 4 GiB RIFF placeholder is read
  • A data chunk just over Array.MaxLength returns a failure
  • A stream longer than 2 GiB returns a failure
  • net8.0 suite: 4299 passed, 10 skipped
  • dotnet format --verify-no-changes

A Matroska position edit refreshes the nested CRC before the parent.
Setting a tag value keeps its sort name and the other languages.
A save with no filesystem uses the one the file was read with.
A short WAV reload, and a sample buffer that cannot be allocated, fail
without writing. A RIFF size of 0xFFFFFFFF is read through to the end
of the stream. A stream past 2 GiB returns a failure instead of throwing.
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.83088% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.01%. Comparing base (851b03f) to head (4230e88).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...s/TagLibSharp2.Tests/Core/WindowedReadEdgeTests.cs 76.77% 36 Missing ⚠️
src/TagLibSharp2/Matroska/MatroskaTag.cs 97.95% 0 Missing and 1 partial ⚠️
...harp2.Tests/Core/SaveThroughReadFileSystemTests.cs 99.37% 0 Missing and 1 partial ⚠️
...s/TagLibSharp2.Tests/Matroska/MatroskaSaveTests.cs 99.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #119      +/-   ##
==========================================
+ Coverage   92.97%   93.01%   +0.03%     
==========================================
  Files         282      283       +1     
  Lines       54202    54782     +580     
  Branches     4961     5028      +67     
==========================================
+ Hits        50392    50953     +561     
- Misses       2260     2280      +20     
+ Partials     1550     1549       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@decriptor
decriptor merged commit 58d38f1 into main Nov 18, 2026
8 checks passed
@decriptor
decriptor deleted the fix/review-main-saves branch November 18, 2026 07:10
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