summaryrefslogtreecommitdiff
path: root/pidl
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2021-05-06 12:05:26 +1200
committerAndreas Schneider <asn@cryptomilk.org>2021-05-28 09:50:02 +0000
commit537f2d19b5513fa9c29034bc53958a2c05768e81 (patch)
tree6bb48742ac7ce569e8908e7de71e6dd6118a9aa9 /pidl
parent9019e08c61a9b0bfce9ef295089ad42e46e784e2 (diff)
downloadsamba-537f2d19b5513fa9c29034bc53958a2c05768e81.tar.gz
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 <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
Diffstat (limited to 'pidl')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm6
1 files changed, 5 insertions, 1 deletions
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;