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

Merge bitcoin-core/secp256k1#1928: tests: add coverage for exact-size DER signature serialization

Public commit record

What the developer wrote

Authored by merge-script

96/100 · Strong
Merge bitcoin-core/secp256k1#1928: tests: add coverage for exact-size DER signature serialization

500ccb60f70550332adf6b6f894ce84659cd6831 tests: add coverage for exact-size DER signature serialization (Bruno Garcia)

Pull request description:

The existing tests only serialize into oversized buffers or one that is far too small, so the boundary case where the output buffer is exactly the required size was untested. Check that this succeeds with identical output, and that one byte less fails while reporting the required size.

Kills the following mutant (https://secp256k1.space/src/ecdsa_impl.h#1141):
```diff
diff --git a/src/ecdsa_impl.h b/src/ecdsa_impl.h
index 5963877..499fe03 100644
--- a/src/ecdsa_impl.h
+++ b/src/ecdsa_impl.h
@@ -176,7 +176,7 @@ static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const
secp256k1_scalar_get_b32(&s[1], as);
while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; }
while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; }
- if (*size < 6+lenS+lenR) {
+ if (*size <= 6+lenS+lenR) {
*size = 6 + lenS + lenR;
return 0;
}
```

ACKs for top commit:
real-or-random:
utACK 500ccb60f70550332adf6b6f894ce84659cd6831
theStack:
ACK 500ccb60f70550332adf6b6f894ce84659cd6831

Tree-SHA512: 8ac002a9e67729f5cb09a9ba8244e926e81898abb273ae4f43a13ccf981322e434caee06d27dcae9b840e0b850908c2281399d48a444319bcc11a0af82bb52a3
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit only adds new test code to check that a specific function behaves correctly when given a buffer of exactly the right size. It does not change any production code, fix a bug, or introduce a vulnerability. It is a routine improvement to the test suite.

Recommended action

No security action needed. This is a benign test-only change.

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.