BIND 10 trac2108_3, updated. 4f132f47001567b8b9f48147546bc714dd28739f [2108] Test some types of errors in zone files don't cause leaks

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Sep 6 01:03:31 UTC 2012


The branch, trac2108_3 has been updated
       via  4f132f47001567b8b9f48147546bc714dd28739f (commit)
      from  94670cafdbca56d6bf2708e83fa9aa07295f579c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4f132f47001567b8b9f48147546bc714dd28739f
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Sep 6 06:32:44 2012 +0530

    [2108] Test some types of errors in zone files don't cause leaks

-----------------------------------------------------------------------

Summary of changes:
 .../datasrc/memory/tests/memory_client_unittest.cc |   20 ++++++++++++++++++++
 src/lib/datasrc/memory/tests/testdata/Makefile.am  |    2 ++
 .../memory/tests/testdata/example.org-broken1.zone |    1 +
 .../memory/tests/testdata/example.org-broken2.zone |    5 +++++
 4 files changed, 28 insertions(+)
 create mode 100644 src/lib/datasrc/memory/tests/testdata/example.org-broken1.zone
 create mode 100644 src/lib/datasrc/memory/tests/testdata/example.org-broken2.zone

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/tests/memory_client_unittest.cc b/src/lib/datasrc/memory/tests/memory_client_unittest.cc
index 048d7be..a7a696e 100644
--- a/src/lib/datasrc/memory/tests/memory_client_unittest.cc
+++ b/src/lib/datasrc/memory/tests/memory_client_unittest.cc
@@ -95,6 +95,26 @@ TEST_F(MemoryClientTest, loadRRsetDoesntMatchOrigin) {
                  MasterLoadError);
 }
 
+TEST_F(MemoryClientTest, loadErrorsInParsingZoneMustNotLeak1) {
+    // Attempting to load broken example.org zone should result in an
+    // exception. This should not leak ZoneData and other such
+    // allocations.
+    EXPECT_THROW(client_->load(Name("example.org"),
+                               TEST_DATA_DIR "/example.org-broken1.zone"),
+                 MasterLoadError);
+    // Teardown checks for memory segment leaks
+}
+
+TEST_F(MemoryClientTest, loadErrorsInParsingZoneMustNotLeak2) {
+    // Attempting to load broken example.org zone should result in an
+    // exception. This should not leak ZoneData and other such
+    // allocations.
+    EXPECT_THROW(client_->load(Name("example.org"),
+                               TEST_DATA_DIR "/example.org-broken2.zone"),
+                 MasterLoadError);
+    // Teardown checks for memory segment leaks
+}
+
 TEST_F(MemoryClientTest, getZoneCount) {
     EXPECT_EQ(0, client_->getZoneCount());
     client_->load(Name("example.org"), TEST_DATA_DIR "/example.org-empty.zone");
diff --git a/src/lib/datasrc/memory/tests/testdata/Makefile.am b/src/lib/datasrc/memory/tests/testdata/Makefile.am
index 6a2a760..e8cd5d1 100644
--- a/src/lib/datasrc/memory/tests/testdata/Makefile.am
+++ b/src/lib/datasrc/memory/tests/testdata/Makefile.am
@@ -1,3 +1,5 @@
 CLEANFILES = *.copied
 
 EXTRA_DIST = example.org-empty.zone
+EXTRA_DIST += example.org-broken1.zone
+EXTRA_DIST += example.org-broken2.zone
diff --git a/src/lib/datasrc/memory/tests/testdata/example.org-broken1.zone b/src/lib/datasrc/memory/tests/testdata/example.org-broken1.zone
new file mode 100644
index 0000000..317095d
--- /dev/null
+++ b/src/lib/datasrc/memory/tests/testdata/example.org-broken1.zone
@@ -0,0 +1 @@
+This is a broken zone that should not parse.
diff --git a/src/lib/datasrc/memory/tests/testdata/example.org-broken2.zone b/src/lib/datasrc/memory/tests/testdata/example.org-broken2.zone
new file mode 100644
index 0000000..2f9fd98
--- /dev/null
+++ b/src/lib/datasrc/memory/tests/testdata/example.org-broken2.zone
@@ -0,0 +1,5 @@
+;; broken example.org zone, where some RRs are OK, but others aren't
+example.org. 3600 IN SOA	ns1.example.org. bugs.x.w.example.org. 73 3600 300 3600000 3600
+ns1.example.org.		      3600 IN A		192.0.2.1
+ns2.example.org.		      3600 IN A		192.0.2.2
+ns2.a.example.com.		      3600 IN AAAA



More information about the bind10-changes mailing list