Skip to content

Conversation

MozirDmitriy
Copy link

@MozirDmitriy MozirDmitriy commented Sep 9, 2025

Description

Add explicit check in Mux to panic when inputs length is zero.
Prevents undefined behavior: previously n==0 led to bits.Len(n-1) on MaxUint and slicing inputs[:leftCount], causing non-obvious runtime panics and potential big.Int overflow in comparator bound construction.
Aligns with package style where invalid shape/size inputs trigger panic, while out-of-range selectors cause proof failure.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

go test -v ./std/selector
go test -v -run "Mux" ./std/selector
go test -v ./...

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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.

1 participant