pidl: check the size of pulled arrays of arrays
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 30 Oct 2019 20:35:19 +0000 (09:35 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Nov 2019 04:41:28 +0000 (04:41 +0000)
We were accidentally checking the memory just past the array instead of
checking each member.

This could have led to the size of some arrays not being checked.

Found by Michael Hanselmann using Honggfuzz and an fuzzer for Samba's
NDR layer.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Pair-programmed-with: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
selftest/knownfail.d/ndrdump [deleted file]

index 8759e46aedb2a09d99c306f238fc23445d24f1e5..c1a2cc99cb7567afa996dfd73a73e741197ab54b 100644 (file)
@@ -1247,10 +1247,14 @@ sub ParseElementPullLevel
 
                if ($deferred and ContainsDeferred($e, $l)) {
                        $self->pidl("for ($counter = 0; $counter < ($length); $counter++) {");
+                       $self->defer("for ($counter = 0; $counter < ($length); $counter++) {");
+                       $self->defer_indent;
                        $self->indent;
                        $self->ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 0, 1);
                        $self->deindent;
+                       $self->defer_deindent;
                        $self->pidl("}");
+                       $self->defer("}");
                }
 
                $self->ParseMemCtxPullEnd($e, $l, $ndr);
diff --git a/selftest/knownfail.d/ndrdump b/selftest/knownfail.d/ndrdump
deleted file mode 100644 (file)
index 4c91544..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba.tests.blackbox.ndrdump.samba.tests.blackbox.ndrdump.NdrDumpTests.test_ndrdump_clusapi_QueryAllValues
\ No newline at end of file