Skip to content

Reject non-canonical (leading-zero) numbers in older()/after()/multi() count parsing - #1340

Merged
NicolasDorier merged 2 commits into
MetacoSA:masterfrom
usefahmed07:fix/1283-older-leading-zero
Sep 23, 2026
Merged

NicolasDorier merged 2 commits into
MetacoSA:masterfrom
usefahmed07:fix/1283-older-leading-zero

Conversation

@usefahmed07

Copy link
Copy Markdown
Contributor

Fixes #1283

older(), after(), and multi()'s count parameter accepted numbers with leading zeros (e.g. older(000000002088829000)), which is non-canonical and should be rejected — matching the behavior of other miniscript implementations (bitcoin-core, rust-miniscript).

Changes

  • TryParseParameterCount and TryParseLocktime in Miniscript.cs now reject any numeric match with a leading zero (length > 1 and first char is '0').
  • Added RejectsNonCanonicalNumbers theory test covering the issue's repro case plus a few positive/negative cases.

@NicolasDorier
NicolasDorier merged commit f7be7e5 into MetacoSA:master Sep 23, 2026
5 checks passed
@usefahmed07
usefahmed07 deleted the fix/1283-older-leading-zero branch September 23, 2026 04:34
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.

Incorrect miniscript parse with older() fragment

2 participants