Repository navigation
v0.5.1
A security release. A private review of 0.5.0, asked for by the maintainer, found three problems
that a crafted disc image can trigger, and a number of smaller ones; all are fixed here. Upgrade
if you convert images you did not rip yourself. Two defaults change with the fixes:
- a run now stops when it would write mostly silence or filler for audio the image lacks (more than
10 seconds beyond the audio it found).--allow-silencegives the old behaviour for a run, to
rescue what a damaged rip still holds; pysacd-extract --templateskeeps files that already exist;--overwritereplaces them.
Output for ordinary discs is unchanged, byte for byte (release checks, below).
Security
- Disc text could place
pysacd-extract's output outside the output folder
(advisory GHSA-gx45-h8q4-vwmc).
For some titles made only of dots, spaces and control characters, the folder or file name derived
from the title was empty,.or... Such names are no longer produced, a relative-ostarting
with../is used as given, and every output path is checked against the output folder before
anything is created. Names of ordinary discs don't change
(what differs from sacd_extract). Upgrade to 0.5.1.
Fixed with it: apysacd convertname could start with-after an empty[]or()was
removed, andpysacd toc --jsonwrote non-ASCII control characters from disc text to the terminal
as they were (it now writes ASCII, with\uescapes). - A disc could replace another disc's files without a warning
(advisory GHSA-whv9-98xg-4xw9).
pysacd convertwrites a disc to<folder> [<catalogue number>]when the folder holds a different
disc; with a very long album title the catalogue number was cut off and the disc went into the
first folder after all. The number is now always kept, and the run stops if no separate folder can
be named.pysacd-extract --templatesreplaced existing files; it now keeps them and reports them
as skipped, and the new--overwritereplaces them. Withsacd_extract's naming nothing changes:
a re-run replaces its files, and the documentation now
says what tells two discs apart there. Upgrade to 0.5.1. - A crafted image could make one run write far more than the image could hold
(advisory GHSA-q45f-7qmf-37x3).
The bound added for #17 held each output to what the image's sectors could hold, but not the whole
run, and frames missing from the image were written as silence without limit, so a small image
could fill a disk. Affects 0.5.0 and earlier; 0.5.1 fixes
it. The outputs of one format in a run may now cover the area at most twice (an edit master and its
tracks), checked before anything is written and again in the engine, and a run stops once it has
written more than 10 seconds of silence beyond the audio it found. Ordinary discs, and truncated
rips whose run still has more audio than silence, extract as before, byte for byte
(security, sacd_extract differences). - Network and credential hardening, found in the same review (low severity, no advisory):
- MusicBrainz ids (release, release group, track, recording, artist) are kept only when they are
MBIDs, and the ISRC plan escapes the release id it prints. A--mb-releasevalue (or
mb_releasein the config) that isn't an MBID is now an error before any request. - MusicBrainz, Cover Art Archive and OAuth requests have a deadline for the whole request (60 s,
300 s for covers), and network errors while reading a reply are retried and reported as
MusicBrainz errors instead of escaping as other exceptions. A malformed ISRC lookup reply no
longer raisesAttributeError, and a token reply'sexpires_inmust be a sane number. - Requests use https only and follow at most 5 redirects, each to https; the token exchange and
the ISRC submission follow none, so credentials only go where they were meant to
(security). - The MusicBrainz token is written through a new file with an unpredictable name, mode 0600 from
creation, and is not saved in a folder that other users can write. - The log no longer records the value of
mb-login --client-secret. - An empty or relative
XDG_CONFIG_HOMEis ignored (as the XDG spec says), instead of making
pysacd readpysacd/config.tomlfrom the current directory. - A copy from a PS3 must average at least 256 KiB/s after a 300 s allowance, so a server can't
stretch it out indefinitely; real PS3s read 2-4 MB/s.
- MusicBrainz ids (release, release group, track, recording, artist) are kept only when they are
- Output hardening, found in the same review (low severity, no advisory):
- frames that don't decode now count with the silence in the limit above, and the new
--allow-silence(pysacd-extractandpysacd convert) lifts that limit for a run, to rescue
what a damaged rip still holds; - a failed or cancelled
-Ino longer leaves a partial.isounder its final name; - a WAV track over 4 GiB is refused before the run starts, instead of failing at the end and
taking the run's finished tracks with it; pysacd convertchecks every output path against the output folder, aspysacd-extractdoes;pysacd-extractwarns when a re-run replaces files of a different size, and with--templates
when a folder already holds another disc's tracks; a run that skipped every file exits with 1;- before reopening a temporary file by name, pysacd checks it is still its own regular file;
- an engine call that returns no result is a failure, not a success.
- frames that don't decode now count with the silence in the limit above, and the new
Release checks for 0.5.1 (docs/development.md, "To release"): tools/extract_compare.py --require-sacd-extract against sacd_extract built from CI's pinned commit, 0.5.0 against the
fixes, on three real discs (stereo and 6-channel DST; plain stereo with 6-channel DST; plain stereo)
in all 35 modes (105 runs, 597 files): no difference between 0.5.0 and the fixes in any run. Against
sacd_extract, of its 319 files 191 are identical and 128 differ only where docs/sacd_extract.md
says they do; none differs otherwise, and -P matches on all three. That run was made before the
one-worker default below (#137) was merged in; with it, the seven plain-DSD and mixed modes were run
again on the two discs with plain areas (14 runs): no difference. The fixes were developed
privately, where CI doesn't run, so these were run by hand on the release tree before it was
published: the full suite (312 passed, the 16 expected skips), the whole suite under ASan and UBSan
(clang), the sacd_extract comparison tests, the engine leak check (memcheck), ruff and mypy. The
beets-pysacd test suite passes against this release's code. Not run by hand: macOS and Windows,
CodeQL, semgrep and TSan, which the release pull request's CI ran. That CI found one defect the
private checks could not: on Windows, a title that sanitises to a name ending in a dot or space
made the run fail (Windows drops them from folder names); such names lose them on Windows now. It
also found three tests that assumed POSIX or Python 3.11.
Other changes
-
CI builds and tests in Red Hat-derived containers. The test suite on Python 3.10 to 3.15, the
ASan/UBSan, leak, fuzz,sacd_extractcomparison and benchmark jobs, the live MusicBrainz lookup
and the release's sdist run in a Fedora 44 container; semgrep, zizmor and the private-names check
in UBI 10, with semgrep and zizmor installed from PyPI by hash instead of their vendors' images.
CI only; the wheels and the package are unchanged (development). -
Plain DSD to DSF or DSDIFF uses one worker thread by default (#137). Nothing is decoded or
filtered there, so a pool the size of the CPU only cost wake-ups. On a 32-thread machine, a
40-minute stereo disc from the page cache to local NVMe (-2 -s, 15 alternating runs, power
profileperformance): engine time 0.17–0.21 s with one worker against 0.20–0.23 s with 32
(medians of three series), the same bytes out.--threadsand-jstill set the count. Not
measured: multichannel plain DSD. -
Python 3.10 is supported again (#140), so pysacd installs with Ubuntu 22.04's own Python. On 3.10 the
config file is read withtomli(installed only there), and CI runs the suite on 3.10 too. The
wheels are unchanged (one per platform serves every Python). -
The engine builds with GCC 11 (Ubuntu 22.04's). GCC before 12 stopped with "no dispatcher found
for the versioning attributes" on the PCM filters' load-time choice of AVX-512 or AVX2; such a
compiler now builds them for the baseline only. Wheels are built with a newer GCC and keep the choice.
Run on Python 3.10.12 and GCC 11.4 in an Ubuntu 22.04 container, as an ordinary user: ruff, mypy, the
engine with-Werror, and the whole suite (267 tests, the expected 16 skipped) pass. -
docs/quickstart.mdnow gives the minimums: Python 3.10, and for wheels glibc 2.28, musl 1.2,
macOS 11 (arm64) or macOS 10.13 (x86-64). -
The macOS wheels run on macOS 11 and later (Apple silicon) and 10.13 and later (Intel) (#142),
instead of macOS 15 only. They link libFLAC 1.5.0, the release Homebrew ships, built in CI from its
release source with the SHA-256 checked, statically, for those versions. -
The engine links scarletbook-rs 0.5.9 (digests checked against the release's
.sha256files
and attestations; the CET shadow-stack mark is kept). Output is byte-identical to the 0.5.8 build in
every mode on the five real test discs; speed is in docs/performance.md. 0.5.9 has nothing new for
pysacd to adopt: its additions are Rust-only (TrackAudioCursor::with_dst_lanes) or documentation
of how to write per-track DSF files, whose writer is planned for scarletbook 0.6.0 (scarletbook-rs#202),
so pysacd's per-track writer stays until then. -
A stale engine is refused with a rebuild message.
src/pysacd/_sacdconv.sois a build product that
git ignores; one built beforesacdconv_cancelwas added failed withAttributeError: undefined symbol: sacdconv_cancel, because pysacd bound that function before it checked the engine's ABI.
It now checks the ABI first, so the error saysengine ABI N, this pysacd needs M; rebuild it (make clean all). A cleanmakefixes such a tree (docs/development.md).