From 537f2d19b5513fa9c29034bc53958a2c05768e81 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Thu, 6 May 2021 12:05:26 +1200 Subject: pidl: Handle assigning to an inline array from Python 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 Reviewed-by: Andrew Bartlett Reviewed-by: Andreas Schneider Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Fri May 28 09:50:02 UTC 2021 on sn-devel-184 --- pidl/lib/Parse/Pidl/Samba4/Python.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pidl') diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index 578e17d1cbc..5c4d3e8e087 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -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; -- cgit v1.2.1