kernel: document that btck_WriteBytes may receive a null pointer #36418

pull alexanderwiederin wants to merge 1 commits into bitcoin:master from alexanderwiederin:kernel-writebytes-nonnull changing 1 files +4 −0
  1. alexanderwiederin commented at 2:22 PM on October 2, 2026: contributor

    The header does not say whether the bytes pointer can be null when size is zero. It can: btck_witness_stack_get_item_at passes std::vector::data() straight through, and that may be null for an empty element.

    An alternative is to guarantee non-null rather than document that it isn't. In other words, route the vector-backed writer calls through a helper that substitutes a valid, never-read pointer when the buffer is empty.

  2. kernel: document that btck_WriteBytes may receive a null pointer
    The header does not say whether the bytes pointer can be null when size
    is zero. It can: the writers backed by std::vector pass through
    std::vector::data(), which may return nullptr for an empty vector, and
    empty elements are ordinary script data.
    
    This matters for bindings rather than for C callers.
    76359bee61
  3. DrahtBot added the label Validation on Oct 2, 2026
  4. DrahtBot commented at 2:22 PM on October 2, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK sedited

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. fanquake added this to a project on Oct 2, 2026
  6. github-project-automation[bot] changed the project status on Oct 2, 2026
  7. sedited approved
  8. sedited commented at 10:52 AM on October 6, 2026: contributor

    ACK 76359bee61edb2062493f0ba4ecd47943c359e0a

    Documenting this seems like the correct call, given that developers can, and should probably, already check if the size is zero.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-07 06:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me