Skip to content

Facade proof: a producer is refused through a parameter that may be NULL (curl_mime_init(easy) → Curl_rand_alnum → random), leaving curl_mime "destroyed but never produced" #3126

Done

Description

@ehartford

Part of #3115; observation 4 of #3111.

curl_mime_free is proven the destroyer, but curl_mime_init is refused ("retains param 0 ... passed to random, which no unit defines"), so the report says "curl_mime: destroyed but never produced here; no resource". The refused path runs through the easy parameter, which since 7.87.0 may be NULL; the mime it returns is the produced object.

Two fixes: an unresolved callee (random, a libc function) on a path should not decide retention of an unrelated parameter; and a function whose return the proven destroyer frees is that resource's producer even when one of its other parameters stays unmodeled (present it with that parameter fixed or optional, cf. the optional-parent grammar issue).

Done when: curl_mime presents with a producer and destroyer from the proof.

Activity

  1. added
    blocked
    on Nov 18, 2026
  2. ehartford commented on Nov 18, 2026

    @ehartford
    ContributorAuthor

    Blocked on #3122 (the optional-parent producer: curl_mime_init(easy) with a NULL-able parent has no clause yet) for the producer half. The other half, an unresolved libc callee (random) deciding retention of an unrelated parameter, is a proof question that goes with #3174's ruling on what an undecided callee may be assumed to do.

  3. removed
    blocked
    on Nov 27, 2026
  4. ehartford commented on Nov 27, 2026

    @ehartford
    ContributorAuthor

    Both halves are now resolved on main (verified against libcurl 8.23.0 on 673ca2631):

    1. Proof half: curl_mime_init is no longer refused through random. The auto-draft now proves:
      curl_mime_init: raw: owned *mut curl_mime (proof: returns mime, a fresh allocation never retained), dropped by curl_mime_free, but param 0 is *mut c_void, which the facade does not describe
      curl_mime_free: destroyer, param 0 (proof: frees it)
    2. Optional-parent producer half: Facade grammar: a producer taking an optional parent (curl_mime_init(easy), NULL allowed since 7.87.0) is presented on the parent and collides with its new #3122 landed from curl_mime_init(null) so the contract can state the optional/null parent explicitly rather than guessing nullability (Law 4). Stating curl_mime in registry/c/libcurl/facts.with is tracked under Registry facade for c.libcurl (HTTP): complete, reviewed, with a zero-unsafe UAT #3143.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions