Repository navigation
docs(clip): say a track read from a clip points into its storage - #299
Merged
Merged
Conversation
siracozmen01
commented
Nov 4, 2026
siracozmen01
left a comment
Contributor
Author
There was a problem hiding this comment.
Review at a68d086: ready.
1. The docs. mtwnClipTrack's comment now says three things, each matching the code:
- the track's keyframes, lengths and mixes, and its easings'
linear()points, point into the clip's storage; - they are valid only while the clip lives, which a sealed clip does unchanged;
- the values layer takes the track "as input the caller built", reading only within the counts it states and checking every segment it reads, so the pointers and counts are the caller's to keep as read.
mtwnClipNodeInfo.timing gains the same note for a linear() easing's points, and clips.md says it in user terms. That is the #120 exception stated in this library's own words.
2. Spot-check: no reliance on the clip's validation.
mtwnSampleTrack(path.c:949-971) checks the track on every call withmtwnValidTrack:- the value kind is at most
mtwn_valueScale; mtwnValidPath: keyframes not NULL,count >= 2, channels 1 to 4, alpha in [0, 1], a log path of one channel, lengths starting at 0 with a finite end;- channels, logarithm, mixes and lengths match the kind.
- the value kind is at most
- It then takes the segment with
FindSegment, which stays within 0 tocount - 2whatever the offsets or lengths hold ("NaN or out of order as a host's changed keyframes may leave them"). - Before reading the segment it checks
Reads: the segment kind is at mostmtwn_segmentMonotone(not a step at constant speed), and timed by keyframes its easing passesmtwnValidEasing.MixReadschecks the segment's color or rotation mix the same way. The segment kind is therefore checked on each call, not trusted frommtwnClip_Seal. mtwnSampleEasing(easing.c:661-679) also runsmtwnValidEasingon every call. That refuses an unknown kind (thedefaultarm accepts only up tomtwn_easingBounce) and requires alinear()easing'spoints != NULL && count >= 2.mtwnSampleLinearPoints(css_easing.c:255) binary-searches indices in[0, count)and readsindexandindex + 1, both belowcount. Unsorted or NaN inputs give a wrong value, never a read outside the stated points.
So the two most likely places to trust clip validation, the segment kind and the easing's point count, are both checked per call, and every read is bounded by the counts the struct states. The Newton and arc-length caps are the session's claim; I did not check them here.
Read, not run.
This was referenced Nov 4, 2026
siracozmen01
added a commit
that referenced
this pull request
Nov 4, 2026
## Problem .github v0.0.50 and v0.0.51 add one rule to the family conventions, on state a caller holds (Rawframe-Project/.github#119 and #120). This library still carried v0.0.48's `maul-conventions.md`, so the nightly family check reported it as differing. ## Change - The family files are synced to v0.0.51 (`family_sync.py --write`). Only `docs/internals/maul-conventions.md` changes, by the rule's one paragraph. - Every reusable workflow pin moves to v0.0.51 (972ea41). No script or workflow changed since v0.0.48. The library follows the rule. The audit is #297: the only structs a call takes back that point into the library's data are clip tracks and timings, which the values layer reads as caller-built input. #299 documents them that way. ## Change of results None. ## Verification - `family_sync.py --check` at v0.0.51 reports 0 differences. - `tools/check.sh changed` passes; no test is reached by the changes. - The organization's docs check passes. Closes #300
Merged
siracozmen01
pushed a commit
that referenced
this pull request
Nov 4, 2026
🤖 I have created a release *beep* *boop* --- ## [1.1.0](v1.0.0...v1.1.0) (2026-11-04) This release makes `mtwnCreateClipPlayer` check its bindings in time linear in their count, where it compared each binding with every one before it ([#292](#292)). A player of 2^20 bindings took 194 s to make at -O2 and now takes 12 ms. At the old rate, the 2^24 slots a clip may have would have taken about 11 hours. Two refusals of a def that binds a slot twice change their status, as below. `MTWN_ABI_VERSION` and a shared library's SOVERSION are now 1.1. A context def stamped by 1.0.0's headers is refused with `mtwn_errorVersion`, so a program built against 1.0.0 is rebuilt; its source builds unchanged. No value, velocity or event record changes. ### Changed - `mtwnCreateClipPlayer` checks its refusals in this order, which its header now states: an invalid def, then the rate's limit, then the context's capacities of players and of bindings, and a slot bound twice last ([#292](#292)). A def that binds a slot twice changes its status only where another refusal also applies: - with the context's players or bindings full, `mtwn_errorCapacity`, not counted as misuse, where it was `mtwn_errorInvalid`, counted; - with a rate past `MTWN_RATE_LIMIT`, `mtwn_errorLimit`, where it was `mtwn_errorInvalid`; both are counted as misuse. - The clips guide and `mtwnClipTrack`'s header say that a track read with `mtwnClip_GetTrack` points into the clip's storage. The values layer takes it as it takes a track the host made, reading only within the counts the track states, so the host keeps it as it was read ([#299](#299)).
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.
Problem
mtwnClip_GetTrackfills anmtwnClipTrackwhose track, and whose easings' linear() points, point into the clip's storage.mtwnClip_GetNodefills a timing whose linear() points do too. The header said only that the track "references the clip's storage, valid while the clip lives". It did not say that the values layer takes such a track back as caller-built input, whose pointers and counts are the caller's to keep. Withtrack.path.countraised to 2^20,mtwnSampleTrackreads past the clip's keyframes (#297).By .github v0.0.51's rule on state a caller holds (Rawframe-Project/.github#120), a struct the header also documents as caller-built input may point into the library's data. That holds only if the call taking it reads through it as through any buffer argument: only within the ranges its own pointers and counts state, checking every value it reads there, and relying on nothing validated earlier.
Change
mtwnClipTrackcomment says what points into the clip's storage, that it is valid only while the clip lives (unchanged, since a sealed clip refuses every change), and that the values layer takes it as input the caller built.mtwnClipNodeInfo's timing says its linear() points are the clip's.docs/user/clips.mdsays the same where it introducesmtwnClip_GetTrack.Change of results
None; comments and the guide only.
Verification
Each of
mtwnSampleTrack,mtwnSamplePath,mtwnComputeTimingandmtwnSampleEasing, read against the rule on main 64415a7:FindSegment,src/path.c:386) is a binary search in[0, count - 2], whatever the offsets or lengths hold.keyframes[i - 1]only fori > 0andkeyframes[i + 2]only fori + 2 < count.[0, count)(src/css_easing.c:255).mtwnValidTrackandmtwnValidPath, checked by every call.mtwnValidEasing), and at constant speed not a step (Reads,src/path.c:497).MixReads).mtwnValidateTimingWork), at everymtwnComputeTiming.src/path_length.c:304) and bys_newtonSteps.mtwnSampleTrackWork) runs only on the clip's own copies, from the library.No gap was found, so no fix is needed.
tools/check.sh changedpasses: clang-tidy on all 45 sources (a header changed), and linux-clang-20-asan 68 of 68.Closes #297