From e91150b266bbd768905258166601fdf333d3d987 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 24 Nov 2019 22:30:48 +0000 Subject: [PATCH] ec.c: Don't lose error status when constructing points from a sequence. The code would call `ecptxl_2' or `ecptxl_3' as appropriate, stash the error status in `rc', and then fall out of the `if/else if' ladder to `ok' -- which clobbers `rc', losing the error. This is unfortunate if the point has been partially filled in. The right fix is to go unconditionally to `end'. We already have `rc' set appropriately, so `ok' isn't necessary; `ecptxl_2' has already converted the point to internal form, and `ecptxl_3' constructs the point in internal form anyway, so it would be wrong to drop into `fix'. --- ec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ec.c b/ec.c index f0747a8..361bbf5 100644 --- a/ec.c +++ b/ec.c @@ -473,6 +473,7 @@ static int ecptxl_1(ec_curve *c, ec *p, PyObject *x) (n == 3 && (z = PySequence_GetItem(t, 2)) == 0)) goto end; rc = (n == 2) ? ecptxl_2(c, p, x, y) : ecptxl_3(c, p, x, y, z); + goto end; } else TYERR("can't convert to curve point"); goto ok; -- 2.11.0