From: Andrew Bartlett Date: Fri, 15 Nov 2019 07:04:41 +0000 (+1300) Subject: pidl: Mismatch between set and get of relative base pointers X-Git-Tag: ldb-2.1.0~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eb560d25e9104dc02477a6bf819d0c37e8afb86;p=thirdparty%2Fsamba.git pidl: Mismatch between set and get of relative base pointers The set was within the switch, the get was before the switch. The difference is shown when there is an empty default element. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13876 Signed-off-by: Andrew Bartlett Reviewed-by: Gary Lockyer --- diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index d51063f7216..31dce4bc2ba 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -2109,11 +2109,6 @@ sub ParseUnionPullDeferred($$$$) my ($self,$e,$ndr,$varname) = @_; my $have_default = 0; - if (defined($e->{PROPERTIES}{relative_base})) { - # retrieve the current offset as base for relative pointers - # based on the toplevel struct/union - $self->pidl("NDR_CHECK(ndr_pull_setup_relative_base_offset2($ndr, $varname));"); - } $self->pidl("switch (level) {"); $self->indent; foreach my $el (@{$e->{ELEMENTS}}) { @@ -2124,6 +2119,11 @@ sub ParseUnionPullDeferred($$$$) $self->pidl("$el->{CASE}:"); if ($el->{TYPE} ne "EMPTY") { $self->indent; + if (defined($e->{PROPERTIES}{relative_base})) { + # retrieve the current offset as base for relative pointers + # based on the toplevel struct/union + $self->pidl("NDR_CHECK(ndr_pull_setup_relative_base_offset2($ndr, $varname));"); + } $self->ParseElementPull($el, $ndr, {$el->{NAME} => "$varname->$el->{NAME}"}, 0, 1); $self->deindent; }