Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Don't mutate the elliptic curve prototype with get* additions #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 3, 2018

  1. Don't mutate the elliptic curve prototype with get* additions

    Point's prototype is set to the prototype of ec('secp256k1').curve.point(), which means mutation to it is shared across users of 'elliptic' via the in-memory representation of those objects.
    
    This is not generally a problem, for example, with `validate` it's a simple set, so the greatest risk is that it will be directly overwritten.
    
    But in the case of `getX` and `getY`, both methods are overwritten with others that depend on the prior implementation as stored in `_get*`. If this happens twice, then the implementation of `_getX` is replaced with something that depends on a call to `_getX`, and the callers is stuck in an infinite loop.
    Empact committed May 3, 2018
    1 Configuration menu
    Copy the full SHA
    b974625 View commit details
    Browse the repository at this point in the history