Repository navigation
Conversation
lusoris
force-pushed
the
fix/model-collection-allocation
branch
2 times, most recently
from
September 19, 2026 10:07
b7dc078 to
5446d13
Compare
lusoris
force-pushed
the
fix/model-collection-allocation
branch
4 times, most recently
from
October 2, 2026 18:38
74450de to
f2def31
Compare
lusoris
force-pushed
the
fix/model-collection-allocation
branch
from
November 1, 2026 23:34
f2def31 to
f2e9135
Compare
lusoris
force-pushed
the
fix/model-collection-allocation
branch
from
November 17, 2026 17:00
f2e9135 to
556f709
Compare
When vmaf_model_collection_append() cannot grow the model array, it jumps to the fail label, which sets *model_collection to NULL without freeing anything. The caller loses its only handle to the collection and every model already in it leaks. realloc() leaves the old array valid on failure, so return -ENOMEM and leave the collection as it was; the caller keeps ownership of the model it tried to append. test_model_collection_alloc fills a collection to capacity, makes the growth realloc() fail, checks that the collection pointer, array, count, capacity and members are unchanged, then retries the append. The test includes model.c, which reaches ref.h and <stdatomic.h>, so it links stdatomic_dependency as test_model does; MSVC refuses that header otherwise. Signed-off-by: Lusoris <lusoris@pm.me>
lusoris
force-pushed
the
fix/model-collection-allocation
branch
from
November 17, 2026 21:50
556f709 to
1e8ea5c
Compare
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.
When
vmaf_model_collection_append()grows an already populated collection andrealloc()fails, the commonfaillabel clears the caller's collection pointer. That loses access to the existing allocation and models even thoughrealloc()left them intact.Return
-ENOMEMdirectly from this growth failure. The original collection stays valid, the new model remains with the caller, and a later append can retry. The successful path is unchanged.The regression injects the failure after filling the initial eight slots, checks the collection pointer, backing array, count, capacity and existing model, retries the append, and destroys the collection. It fails against the original implementation with “allocation failure lost the existing collection”. The test includes
model.c, which reachesref.hand<stdatomic.h>, so it linksstdatomic_dependencyastest_modeldoes; without it the MSVC build stops with C1189.Update, 2026-11-17: the commit now also gives the new test
stdatomic_dependency; nothing else changed. The branch is based on4611e47a; the commands below were last run on9e48141b.stdatomic_dependencyline the Windows run fails with C1189 in both MSVC builds (its MinGW job failed earlier, on a package mirror download).Validation against upstream
9e48141bd1eb8d2329e09d3744e7c24af53017ca, x86-64 Linux, GCC 16.2.1, Meson 1.12.1. Rebased on master 9e48141 (2026-10-02); the patch is unchanged and the results below were re-run (the negative control was run on 6ec23e8; the code involved is unchanged in 9e48141):No scoring code or golden-data assertions changed; the three Netflix reference pairs score identically with and without this change (default dispatch and SIMD masked off). Sanitizer acceptance here is for the new regression; separate baseline leaks in upstream
test_predictandtest_pic_preallocationremain outside this patch.