Skip to content

Commit 484d4a8

Browse files
author
Release Manager
committed
sagemathgh-35799: test whether point is actually on the curve when evaluating elliptic-curve isomorphism In Sage 10.0: ```sage sage: E = EllipticCurve(GF(101), [1,1]) sage: f = E.automorphisms()[0] sage: EE = EllipticCurve(GF(101), [5,5]) sage: P = EE.lift_x(2) sage: P in f.domain() False sage: f(P) (2 : 15 : 1) sage: f(P) in f.codomain() True sage: f.codomain().defining_polynomial()(*f(P)) 12 ``` Sage will happily "evaluate" a `WeierstrassIsomorphism` on just about any `EllipticCurvePoint`, even a point which explicitly lies on a *different* curve. This simple patch adds a check to remove this footgun. URL: sagemath#35799 Reported by: Lorenz Panny Reviewer(s): Kwankyu Lee
2 parents 4e31ef2 + 94068f7 commit 484d4a8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/sage/schemes/elliptic_curves/weierstrass_morphism.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def _eval(self, P):
611611
Q = baseWI.__call__(self, P)
612612
return self._codomain.base_extend(k).point(Q)
613613

614-
def __call__(self, P):
614+
def _call_(self, P):
615615
r"""
616616
Call function for WeierstrassIsomorphism class.
617617
@@ -648,6 +648,24 @@ def __call__(self, P):
648648
432
649649
sage: E(i(P))._order
650650
432
651+
652+
Check that the isomorphism cannot be evaluated on points outside
653+
its domain (see :issue:`35799`)::
654+
655+
sage: # needs sage.rings.finite_rings
656+
sage: E = EllipticCurve(GF(101), [1,1])
657+
sage: f = E.automorphisms()[0]
658+
sage: EE = EllipticCurve(GF(101), [5,5])
659+
sage: P = EE.lift_x(2)
660+
sage: P in f.domain()
661+
False
662+
sage: f(P)
663+
Traceback (most recent call last):
664+
...
665+
TypeError: (2 : 15 : 1) fails to convert into the map's
666+
domain Elliptic Curve defined by y^2 = x^3 + x + 1 over
667+
Finite Field of size 101, but a `pushforward` method is
668+
not properly implemented
651669
"""
652670
if P[2] == 0:
653671
return self._codomain(0)

0 commit comments

Comments
 (0)