Skip to content

Fix DERSignature.stream_serialize length omission - #190

Closed
m4burns wants to merge 1 commit into
petertodd:masterfrom
m4burns:patch-1
Closed

m4burns wants to merge 1 commit into
petertodd:masterfrom
m4burns:patch-1

Conversation

@m4burns

@m4burns m4burns commented Sep 19, 2018

Copy link
Copy Markdown

DERSignature.stream_serialize does not write the remaining length of the message after the header byte.

This patch resolves the issue by writing the length of what remains to be written immediately after the header byte.

DERSignature.stream_serialize does not write the remaining length of the message after the header byte.

This patch resolves the issue by writing the length of what remains to be written immediately after the header byte.
@dgpv

dgpv commented Oct 18, 2018

Copy link
Copy Markdown
Contributor

Why not use self.length ? it is already calculated and set in stream_deserialize()

@dbolser

dbolser commented Dec 11, 2018

Copy link
Copy Markdown

Did you try this fix and test?

@dgpv

dgpv commented Dec 11, 2018 •

Copy link
Copy Markdown
Contributor

@dbolser, If your question is directed to me: I did not, because signature.py is removed in https://github.com/Simplexum/python-bitcointx - libsecp256k1 functions are used for parsing/encoding signatures.

@dbolser

dbolser commented Dec 11, 2018

Copy link
Copy Markdown

OK, seems like this should be closed (@petertodd).

@petertodd

Copy link
Copy Markdown
Owner

@dbolser Alright, closing.

@petertodd petertodd closed this Dec 12, 2018
@dgpv

dgpv commented Dec 12, 2018 •

Copy link
Copy Markdown
Contributor

This change seem to actually fix the bug in DERSignature.stream_serialize(), it is just that this method is not used in python-bitcoinlib code at all (only deserialize is used).

@petertodd I think this PR should be left open, as there might be the people who will try to use this code to serialize a signature, and will hit the bug. At least they can find solution here. And if someone picks up the mainteinance of the library as-is, they will know what patches to apply.

kumar-miskin added a commit to kumar-miskin/python-bitcoinlib that referenced this pull request Oct 10, 2026
Related: petertodd#295. Prior art: petertodd#190 identified the missing sequence length.
AI-assisted patch preparation and testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants