From 8f46aec409ea4d507db00ea3bbdea81fd3cc6ed4 Mon Sep 17 00:00:00 2001 Message-Id: <8f46aec409ea4d507db00ea3bbdea81fd3cc6ed4.1715956378.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 11 May 2017 10:42:15 +0100 Subject: [PATCH] utils.c: Raise exceptions from `convTHING' with null arguments. Organization: Straylight/Edgeware From: Mark Wooding This can happen as a result of using `convTHING' in an attribute `set' function, and the Python program trying to `del' the attribute. Unfortunately, these conversion functions are already being used in this context, and it leads to segfaults, e.g., from del C.Key(C.KeyFile('', C.KOPEN_WRITE | C.KOPEN_NOFILE), 0, 'k').exptime Easy fix. --- util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util.c b/util.c index d4b7fb0..7118bfb 100644 --- a/util.c +++ b/util.c @@ -133,6 +133,7 @@ int convk64(PyObject *o, void *pp) int rc = 0; uint32 lo, hi; + if (!o) VALERR("can't delete"); if (init_i32()) goto end; if ((i = PyNumber_Int(o)) == 0) goto end; lo = PyInt_AsUnsignedLongMask(i); -- [mdw]