AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 34 Bitcoin

kernel: Allow null arguments for serialized data

Public commit record

What the developer wrote

Authored by TheCharlatan

68/100 · Adequate
kernel: Allow null arguments for serialized data

An empty span constructed from an empty vector may have a null data
pointer depending on the implementation. Remove the
BITCOINKERNEL_ARG_NONNULL requirement for these arguments and instead
handle such null arguments in the implementation.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change loosens a strict rule in the Bitcoin Core kernel library so that callers can safely pass an empty data buffer even if its internal memory pointer happens to be null. Previously the library declared that certain pointers could never be null, which could cause crashes or undefined behavior when empty vectors produced null pointers. The patch now checks for the one truly invalid case—a null pointer paired with a non-zero length—and otherwise accepts null pointers when the length is zero.

Recommended action

Treat as a defensive hardening fix. Review downstream language bindings and callers to ensure they do not rely on the removed non-null guarantee, and verify that the new null-with-nonzero-length checks are consistently applied to any other serialized-data entry points.

Security signals we found

01

Removal of non-null contract annotations due to implementation-defined null pointers on empty spans

02

Addition of null-pointer-with-nonzero-length guards in three C API entry points

03

New unit tests covering null pointer + non-zero length and empty serialized inputs

04

Potential for undefined behavior or crashes if a null pointer with non-zero length were dereferenced

Risk score

Why this scored 34/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.