Repository navigation
test(model): cover a failed model-collection growth - #1663
Merged
Merged
Conversation
6 of 26 tasks
vmaf_model_collection_append() doubles its model array when the eighth slot is taken. Upstream Netflix/vmaf takes its common failure label when that realloc() fails and clears the caller's handle, which loses the collection and its models; the fork returns -ENOMEM directly and leaves the collection untouched. That is the fix of our upstream PR #1590, and no test called vmaf_model_collection_append() at all. test_model_collection_growth links with -Wl,--wrap=realloc, fails the one realloc() of the model array, and checks on real models that eight models fill the initial array without growing it, that the ninth doubles it once and keeps every member, and that a failed growth returns -ENOMEM, changes nothing, and lets the caller append the rejected model again. With upstream's "*model_collection = NULL" put back the third case fails. No library code changes.
lusoris
force-pushed
the
port/upstream-1590-model-collection-growth-test
branch
from
October 1, 2026 08:15
c8edb32 to
0873165
Compare
lusoris
added a commit
that referenced
this pull request
Oct 1, 2026
Each of the fork's fifteen open Netflix/vmaf pull requests (#1588 to against the fork's code, with ASan + UBSan builds where the report is about memory or undefined behaviour. The fork needs none of the six commits. It carries the fix of every pull request except the second revision of #1602, which is a score change left to the maintainer. Three gaps found on the way are in their own pull requests: #1662 (a negative threshold shift in the scalar adm_cm), #1663 and #1664 (regression tests for #1590 and #1604). docs/state.md gains seventeen rows under "Confirmed not-affected", each with the fork file and function, the test, and what was run; the #1604 row is corrected (the tool refuses odd 4:2:0 dimensions for raw input only). docs/rebase-notes.md says what a sync can skip and what it must keep. docs/development/known-upstream-bugs.md lists all fifteen pull requests with the fork's status and records that they are no longer updated while upstream does not act on them.
lusoris
added a commit
that referenced
this pull request
Oct 1, 2026
* docs(state): record the 2026-10-01 upstream reconciliation Each of the fork's fifteen open Netflix/vmaf pull requests (#1588 to against the fork's code, with ASan + UBSan builds where the report is about memory or undefined behaviour. The fork needs none of the six commits. It carries the fix of every pull request except the second revision of #1602, which is a score change left to the maintainer. Three gaps found on the way are in their own pull requests: #1662 (a negative threshold shift in the scalar adm_cm), #1663 and #1664 (regression tests for #1590 and #1604). docs/state.md gains seventeen rows under "Confirmed not-affected", each with the fork file and function, the test, and what was run; the #1604 row is corrected (the tool refuses odd 4:2:0 dimensions for raw input only). docs/rebase-notes.md says what a sync can skip and what it must keep. docs/development/known-upstream-bugs.md lists all fifteen pull requests with the fork's status and records that they are no longer updated while upstream does not act on them. * docs(upstream): keep the reconciliation page to the technical status
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.
Summary
This adds the regression test that the fork was missing for the fix of our upstream Netflix/vmaf PR #1590. No library code changes.
vmaf_model_collection_append()doubles its model array when the eighth slot is taken. Upstream takes its common failure label when thatrealloc()fails and clears the caller's handle, which loses the collection and its models. The fork already returns-ENOMEMdirectly and leaves the collection untouched (core/src/model.c), but no test calledvmaf_model_collection_append()at all, so a rebase onto upstream's version would have gone unnoticed.test_model_collection_growthlinks with-Wl,--wrap=realloc, fails the onerealloc()of the model array, and checks three cases on real models loaded frommodel/vmaf_v0.6.1.json:-ENOMEM, leaves handle, array, count, capacity and members unchanged, and the rejected model can be appended on retry.Type
feat— new featurefix— bug fixperf— performance improvementrefactor— no behavior changedocs— documentation onlytest— test-onlybuild/ci— tooling / infraport— cherry-pick from upstream Netflix/vmafsycl/cuda/simd— backend-specificChecklist
make format && make lintis green locally. Not run in full. Run instead:clang-format --dry-run -Werroron the new file (clean),scripts/ci/tidy-ratchet.py --lane cpu --only core/test/test_model_collection_growth.c(0 warnings in the file), and the pre-commit hook set (passed)./cross-backend-diffand the worst ULP is ≤ 2. None touched..c/.cpp/.cu/.h/.hpp, it has the appropriate license header (seeCONTRIBUTING.md).!orBREAKING CHANGE:and the migration path is documented below.docs/adr/_index_fragments/<NNNN-slug>.mdand the slug is appended todocs/adr/_index_fragments/_order.txt.Bug-status hygiene (ADR-0165)
docs/state.mdupdated:T-MODEL-COLLECTION-GROWTH-FAILURE-UNTESTED-2026-10-01under Recently closed.Netflix golden-data gate (ADR-0024)
assertAlmostEqual(...)score in the Netflix golden Python tests.Deep-dive deliverables (ADR-0108)
--wrapcontrol the neighbouring ownership tests use.AGENTS.mdinvariant note — no rebase-sensitive invariants beyond the rebase note below.changelog.d/changed/test-model-collection-growth-failure.md.docs/rebase-notes.md.Reproducer
CC=gcc meson setup build-san core -Db_lto=false -Denable_cuda=false -Denable_sycl=false \ -Denable_float=true -Db_sanitize=address,undefined -Dbuildtype=debugoptimized ninja -C build-san test/test_model_collection_growth ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 UBSAN_OPTIONS=halt_on_error=1 \ build-san/test/test_model_collection_growth # 3 tests run, 3 passedNegative control, run locally and not committed: with upstream's
*model_collection = NULLput back into the growth branch ofvmaf_model_collection_append(), the third case fails witha failed growth lost or changed the existing collection.Known follow-ups
None. The test is built on Linux with the static archive and without LTO only, because
--wrapneeds the linker to see the library's reference torealloc;test_registration_partial_copyhas the same constraint.