talloc: pytalloc_get_checked_type: survive non-talloc objects
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 9 Jul 2019 09:44:12 +0000 (09:44 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 22 Jul 2019 22:20:25 +0000 (22:20 +0000)
If the python object is not a talloc object, we will end up
with a NULL pointer. We weren't checking for that properly

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/talloc/pytalloc_util.c
selftest/knownfail.d/python-segfaults

index 82b95e7f144fec1f60aa032172e61ca22481c666..4193ca895ce3d2752c8c53802b65be8d984e7e02 100644 (file)
@@ -247,7 +247,7 @@ static void *_pytalloc_get_checked_type(PyObject *py_obj, const char *type_name,
        mem_ctx = _pytalloc_get_mem_ctx(py_obj);
        ptr = _pytalloc_get_ptr(py_obj);
 
-       if (mem_ctx != ptr) {
+       if (mem_ctx != ptr || ptr == NULL) {
                if (check_only) {
                        return NULL;
                }
index 42f83f8b8b9c6cf729a54736d9baa72b469c06ea..76fc645c2b6565f16901640a0352c8229dce6e61 100644 (file)
@@ -1,4 +1,2 @@
 samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_encrypt_netr_crypt_password
-samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_hive_open_ldb
-samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_net_replicate_chunk_1
 samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_net_replicate_init__3