From 684cd535271b825618bab1cae1fcce11b778f6d0 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 10 Nov 2019 22:55:11 +0000 Subject: [PATCH] mp.c: Check that CRT moduli are actually positive. --- mp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mp.c b/mp.c index a234c6d..77f7c3c 100644 --- a/mp.c +++ b/mp.c @@ -1737,6 +1737,7 @@ static PyObject *mpcrt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) for (i = 0; i < n; i++) { if ((x = PySequence_GetItem(q, i)) == 0) goto end; xx = getmp(x); Py_DECREF(x); if (!xx) goto end; + if (MP_CMP(xx, <=, MP_ZERO)) VALERR("moduli must be positive"); v[i].m = xx; v[i].n = 0; v[i].ni = 0; v[i].nni = 0; } c = (mpcrt_pyobj *)ty->tp_alloc(ty, 0); -- 2.11.0