Fix bug 8920, null dereference
[Samba/gebeck_regimport.git] / pidl / tests / ndr_fullptr.pl
blobcc6fca7ab39bcd46a0752fe0dbef57cb9cbe4639
1 #!/usr/bin/perl
2 # Simple tests for unique pointers
3 # (C) 2006 Jelmer Vernooij <jelmer@samba.org>.
4 # Published under the GNU General Public License.
5 use strict;
7 use Test::More tests => 1 * 8;
8 use FindBin qw($RealBin);
9 use lib "$RealBin";
10 use Util qw(test_samba4_ndr);
12 SKIP: {
13 skip "full pointers not supported yet", 8;
15 test_samba4_ndr("fullptr-push-dup",
17 [public] uint16 echo_TestFull([in,ptr] uint32 *x, [in,ptr] uint32 *y);
20 struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL);
21 uint32_t v = 13;
22 struct echo_TestFull r;
23 r.in.x = &v;
24 r.in.y = &v;
26 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_echo_TestFull(ndr, NDR_IN, &r))) {
27 fprintf(stderr, "push failed\n");
28 return 1;
31 if (ndr->offset != 12) {
32 fprintf(stderr, "Offset(%d) != 12\n", ndr->offset);
33 return 2;
36 if (ndr->data[0] != ndr->data[8] ||
37 ndr->data[1] != ndr->data[9] ||
38 ndr->data[2] != ndr->data[10] ||
39 ndr->data[3] != ndr->data[11]) {
40 fprintf(stderr, "Data incorrect\n");
41 return 3;
43 ');