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
Facade proof: 'stored in a global' (187 functions, 14 libraries) and 'stored through a local' (165) read as retention; most are a gzgets-style scratch write or a debug hook #3175
Part of #3115; clusters from the #3116 survey: 'retains a parameter, stored in a global' 187 functions (zlib gzgets, …), 'stored through a local' 165 (zlib crc32), 'stored' 156 (deflateSetDictionary). Sibling of #3124 (self-state stores). Each needs a look at what the store is: a copy of bytes (no retention), a write through a local alias of the parameter (a store into the parameter, not of it), or a real registration. The proof conflates 'wrote through p' with 'kept p'.
Two shapes fixed in #3200 (main 659ae4f): a parameter assigned to a local of the body is an alias, not a store into a global (zlib gzgets' str = buf), and a write into the parameter's own variable stores nothing (crc32_z's buf = (const unsigned char *)words). Left here: the plain 'stored' shape (paramstore, 156 functions, deflateSetDictionary) and whatever 'stored through a local' remains after the next survey; both need their C read the same way (WITH_KEEP_BUILD=1 keeps a fetch's tree).
Report half landed in #3432: a stored parameter is reported with the place it was stored in, as the source spells it (retains param 1 (stored in a field, strm->next_in)), so a reader can tell a registration from a scratch slot.
What reading zlib's C showed for the proof half (pinned zlib 1.4, kept build tree):
gz_read (gzread.c) leaves the caller's buffer in state->strm.next_out after the call returns. That is a real stale pointer in the record; the next call overwrites it before use.
deflateSetDictionary (deflate.c) saves strm->next_in, points it at the dictionary, runs fill_window, and restores it.
Neither is provable as 'not retained' without following a pointer through a record field across calls. They are the same shape as #3173 (a buffer paired with fields of the record, cleared after the call), so the remaining 'stored in a field' cases of this kind move with that ruling, not with a looser proof here.
Needs Eric: the report half landed (#3432). The remaining 'stored in a field' cases read in zlib are a buffer left in or swapped through the stream record, which is #3173's field-pairing clause, awaiting his ruling on that brief.
A concrete case for the "stored through a local / out-pointer" half, read from the pinned libcurl 8.23.0 (lib/mprintf.c 151 to 159), reached now that #3570 removed the false va_start stop:
staticintdollarstring(constchar*p, constchar**end)
{
…
*end=p; /* a pointer into the caller's string, handed back */return (int)num-1;
}
…
precision=dollarstring(fmt, &fmt); /* callers pass the address of their own local */
The proofs read *end = p as a store, so curl_mprintf's format is "retained" (… passed to dollarstring at param 0, stored in *end``). Nothing is kept: the callee returns a pointer derived from p through an out-parameter, and each caller passes the address of a local in its own frame that already stands for the same parameter. It is `strtol`'s `endptr` shape.
The rule that would decide it: a parameter (or a pointer derived from it) written through another parameter's slot is returned through that parameter, not stored; the caller is then judged by what it passed for the slot. The address of one of its own locals: the local now stands for the parameter (it is followed like any alias). Its own out-parameter: the caller returns it the same way. Anything else (a field, a global): retained, as today. A public function that returns its parameter this way stays raw until a facade can state the borrow.
That extends what the proofs accept as "not kept", so it is a proof-rule decision (D198: enumerable; D51: a wrong inference here grants a lend). Bringing it to Eric as a brief; not implemented.
Labelled human attn needed: the out-parameter rule in the comment above (a parameter written through another parameter's slot is returned through it, not stored) is a proof-rule decision. The case it would decide is libcurl's dollarstring, the same shape as strtol's endptr.
A: a parameter (or a pointer derived from it) written through another parameter's slot is returned through that parameter, not stored, the caller judged by what it passed for the slot. First cut limited to a direct write through the parameter (*out = p); out->field = p stays a store. Public functions that return a parameter this way stay raw. Label removed; this is mine.
Activity
#3175: a parameter's local alias is no global store, and a write to t…
ehartford commentedon Nov 9, 2026
Two shapes fixed in #3200 (main 659ae4f): a parameter assigned to a local of the body is an alias, not a store into a global (zlib gzgets'
str = buf), and a write into the parameter's own variable stores nothing (crc32_z'sbuf = (const unsigned char *)words). Left here: the plain 'stored' shape (paramstore, 156 functions, deflateSetDictionary) and whatever 'stored through a local' remains after the next survey; both need their C read the same way (WITH_KEEP_BUILD=1 keeps a fetch's tree).Contract report: a stored parameter is reported with the place it was…
ehartford commentedon Nov 18, 2026
Report half landed in #3432: a stored parameter is reported with the place it was stored in, as the source spells it (
retains param 1 (stored in a field,strm->next_in)), so a reader can tell a registration from a scratch slot.What reading zlib's C showed for the proof half (pinned zlib 1.4, kept build tree):
gz_read(gzread.c) leaves the caller's buffer instate->strm.next_outafter the call returns. That is a real stale pointer in the record; the next call overwrites it before use.deflateSetDictionary(deflate.c) savesstrm->next_in, points it at the dictionary, runsfill_window, and restores it.Neither is provable as 'not retained' without following a pointer through a record field across calls. They are the same shape as #3173 (a buffer paired with fields of the record, cleared after the call), so the remaining 'stored in a field' cases of this kind move with that ruling, not with a looser proof here.
ehartford commentedon Nov 18, 2026
Needs Eric: the report half landed (#3432). The remaining 'stored in a field' cases read in zlib are a buffer left in or swapped through the stream record, which is #3173's field-pairing clause, awaiting his ruling on that brief.
ehartford commentedon Nov 23, 2026
A concrete case for the "stored through a local / out-pointer" half, read from the pinned libcurl 8.23.0 (lib/mprintf.c 151 to 159), reached now that #3570 removed the false
va_startstop:The proofs read
*end = pas a store, socurl_mprintf's format is "retained" (… passed to dollarstring at param 0, stored in*end``). Nothing is kept: the callee returns a pointer derived frompthrough an out-parameter, and each caller passes the address of a local in its own frame that already stands for the same parameter. It is `strtol`'s `endptr` shape.The rule that would decide it: a parameter (or a pointer derived from it) written through another parameter's slot is returned through that parameter, not stored; the caller is then judged by what it passed for the slot. The address of one of its own locals: the local now stands for the parameter (it is followed like any alias). Its own out-parameter: the caller returns it the same way. Anything else (a field, a global): retained, as today. A public function that returns its parameter this way stays raw until a facade can state the borrow.
That extends what the proofs accept as "not kept", so it is a proof-rule decision (D198: enumerable; D51: a wrong inference here grants a lend). Bringing it to Eric as a brief; not implemented.
ehartford commentedon Nov 24, 2026
Labelled
human attn needed: the out-parameter rule in the comment above (a parameter written through another parameter's slot is returned through it, not stored) is a proof-rule decision. The case it would decide is libcurl'sdollarstring, the same shape asstrtol'sendptr.ehartford commentedon Nov 25, 2026
Ruled by Eric, 2026-11-25 (answers to briefs.md).
A: a parameter (or a pointer derived from it) written through another parameter's slot is returned through that parameter, not stored, the caller judged by what it passed for the slot. First cut limited to a direct write through the parameter (
*out = p);out->field = pstays a store. Public functions that return a parameter this way stay raw. Label removed; this is mine.Treat direct *out = p writes as out-parameter returns in facade reten…