]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pidl: Handle assigning to an inline array from Python
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 6 May 2021 00:05:26 +0000 (12:05 +1200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 28 May 2021 09:50:02 +0000 (09:50 +0000)
When obtaining a reference to items in an assigned-from list, ensure
that we do not try to use the first element of the inline array as a
talloc context, but instead use the talloc context associated with the
Python object.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14065

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri May 28 09:50:02 UTC 2021 on sn-devel-184

pidl/lib/Parse/Pidl/Samba4/Python.pm
selftest/knownfail.d/python-segfaults

index 578e17d1cbcc887338142fc392a85111d12b0ddb..5c4d3e8e0877a713dabc50296fb503f662b3318d 100644 (file)
@@ -1988,7 +1988,11 @@ sub ConvertObjectFromPythonLevel($$$$$$$$$)
                        }
                        $self->pidl("for ($counter = 0; $counter < PyList_GET_SIZE($py_var); $counter++) {");
                        $self->indent;
-                       $self->ConvertObjectFromPythonLevel($env, $var_name, "PyList_GET_ITEM($py_var, $counter)", $e, $nl, $var_name."[$counter]", $fail, 0);
+                       if (ArrayDynamicallyAllocated($e, $l)) {
+                               $self->ConvertObjectFromPythonLevel($env, $var_name, "PyList_GET_ITEM($py_var, $counter)", $e, $nl, $var_name."[$counter]", $fail, 0);
+                       } else {
+                               $self->ConvertObjectFromPythonLevel($env, $mem_ctx, "PyList_GET_ITEM($py_var, $counter)", $e, $nl, $var_name."[$counter]", $fail, 0);
+                       }
                        $self->deindent;
                        $self->pidl("}");
                        $self->deindent;
index 2dc8e4577b6e9a69ed41d1f6d48fc2aebe0481b9..1be0566dcb1eab45e2509718e14dff7419b27e90 100644 (file)
@@ -1,2 +1 @@
 samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_net_replicate_init__3
-samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_dcerpc_idl_set_inline_arrays