chiark
/
gitweb
/
~mdw
/
catacomb-python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d9782ff
)
mp.c: Check that CRT moduli are actually positive.
author
Mark Wooding
<mdw@distorted.org.uk>
Sun, 10 Nov 2019 22:55:11 +0000
(22:55 +0000)
committer
Mark Wooding
<mdw@distorted.org.uk>
Fri, 22 Nov 2019 22:18:10 +0000
(22:18 +0000)
mp.c
patch
|
blob
|
blame
|
history
diff --git
a/mp.c
b/mp.c
index a234c6d27c483727e14a99b123215e9299b909c7..77f7c3cc7c8c9b50882b4886478a1730299a0365 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);