You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ownership engine: a NULL reset joined with a path where the resource is still live #276
Pattern 1 of the #104 comment of 2026-10-26 (libwebp EncodeImageInternal, sudo eventlog.c,
OpenSSH kex.c), in the shape that the engine-based DoubleRelease planned for #104 does not
cover: the pointer is released and reset to NULL, and the cleanup label is also reached by an
earlier path where the resource is still live.
// resource-model: models/resource-lifetime/generic.txt#include<stdlib.h>intnull_reset_then_cleanup(interr, interr2)
{
char*p=malloc(8);
if (err)
goto fail; /* p live */free(p);
p=NULL;
if (err2)
goto fail; /* p NULL */return0;
fail:
free(p); /* reported: potential double release */return1;
}
At fail, the engine joins "p holds the resource, which is live" with "p holds NULL, the
resource is released", and keeps "p may hold the resource, which may be released". The UseAfterRelease side has the same limit (known limit of #270: if (c) { free(p); p = NULL; } if (p) *p = 1;).
A related case: when the variable's address is passed to a function anywhere in the function,
its stores are weak updates, so p = NULL after the release is not seen at all:
After a strong write to a storage location, a resource that leaves it, that no other storage
location names, and that is only Released becomes NotOwned on that path (parameter resources
excluded, so summaries and the cache do not change). The weak-update case needs its own rule.
This touches the state shared by UseAfterRelease, MissingRelease and ReferenceLost, so it
needs its own before/after measurement and a separate proof for aliases and for SSA values that
may still be used after the store.
Acceptance
null_reset_then_cleanup above: no report.
q = p; free(p); p = NULL; free(q);: still reported.
if (c) { free(p); p = NULL; } if (p) *p = 1;: no UseAfterRelease.
Activity