Skip to content

math/big: ModSqrt returns wrong value when aliasing parameters #22265

@FiloSottile

Description

@FiloSottile

What version of Go are you using (go version)?

go 1.9

What operating system and processor architecture are you using (go env)?

  • darwin_amd64
  • Playground

What did you do?

Aliased z and x in ModSqrt, as allowed by the package docs and not disallowed by the function docs.

y.ModSqrt(y, p.P)

https://play.golang.org/p/MsOief8jlg

What did you expect to see?

The same result as new(big.Int).ModSqrt(y, p.P).

What did you see instead?

An incorrect value is computed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions