mp.c: Fix crash converting elliptic curve point-at-infinity to integer.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 Nov 2019 13:23:49 +0000 (13:23 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 22 Nov 2019 22:18:11 +0000 (22:18 +0000)
mp.c

diff --git a/mp.c b/mp.c
index e9268e5..7c9146c 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -211,6 +211,7 @@ mp *tomp(PyObject *o)
     return (MP_COPY(PFILT_F(o)->m));
   else if (ECPT_PYCHECK(o)) {
     ec p = EC_INIT;
+    if (EC_ATINF(ECPT_P(o))) return (0);
     getecptout(&p, o);
     x = MP_COPY(p.x);
     EC_DESTROY(&p);