pqlen = (p[0] > q[0] ? p[0] : q[0]);
+ /* Make sure that we're allowing enough space. The shifting below will
+ * underflow the vectors we allocate if `pqlen' is too small.
+ */
+ if (2*pqlen <= mlen)
+ pqlen = mlen/2 + 1;
+
/* Allocate n of size pqlen, copy p to n */
n = snewn(pqlen, BignumInt);
i = pqlen - p[0];