~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mp.c: Check that CRT moduli are actually positive.
[catacomb-python]
/
mp.c
diff --git
a/mp.c
b/mp.c
index
a234c6d
..
77f7c3c
100644
(file)
--- 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;
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);
v[i].m = xx; v[i].n = 0; v[i].ni = 0; v[i].nni = 0;
}
c = (mpcrt_pyobj *)ty->tp_alloc(ty, 0);