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

tests: add coverage for the DER long form length encoding

Public commit record

What the developer wrote

Authored by Bruno Garcia

88/100 · Strong
tests: add coverage for the DER long form length encoding

random_ber_signature only emits long form lengths in signatures it marks
as certainly_not_der, so run_ecdsa_der_parse asserts that such inputs are
rejected but never that a well-formed long form length is accepted. As a
result, inverting any of the four conditions in secp256k1_der_read_len
that govern the long form goes unnoticed by the test suite.

Add the accepting cases, together with the two rejecting ones that share
their boundaries: a length below 128, which must use the short form, and
length octets with a leading zero. Since DER permits the long form only
for lengths of at least 128, which a signature with two in-range scalars
never reaches, the R integers in the accepting cases are longer than 32
bytes and are therefore parsed as zero; the test checks the parsed values
so this stays pinned down.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit only adds new test cases to the project's test suite. It does not change any production parsing code. The tests verify that the existing DER signature parser correctly accepts valid long-form length encodings and rejects invalid ones. There is no security vulnerability being fixed here.

Recommended action

No action required. This is a benign test-only commit that improves coverage for DER length encoding edge cases.

Security signals we found

No strong security signals were identified.

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/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.