BIND 10 master, updated. cb81101a054cf68bcd374b218092c2da3c611999 Merge branch 'trac2443'
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jan 29 14:20:48 UTC 2014
The branch, master has been updated
via cb81101a054cf68bcd374b218092c2da3c611999 (commit)
via 84de42ee09a14ef8d2a066815f99700e133dcc33 (commit)
via 60a4f25645165d590b0130f810472418cdf3f5b4 (commit)
from 2002e7a128f2b4d84d0f67a45e8e0fec2bf541c3 (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 cb81101a054cf68bcd374b218092c2da3c611999
Merge: 2002e7a 84de42e
Author: Mukund Sivaraman <muks at isc.org>
Date: Wed Jan 29 19:11:38 2014 +0530
Merge branch 'trac2443'
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/labelsequence.cc | 17 +++++++++++++++--
src/lib/dns/tests/labelsequence_unittest.cc | 10 +++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/labelsequence.cc b/src/lib/dns/labelsequence.cc
index f5f6a95..91af633 100644
--- a/src/lib/dns/labelsequence.cc
+++ b/src/lib/dns/labelsequence.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -12,6 +12,8 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <config.h>
+
#include <dns/labelsequence.h>
#include <dns/name_internal.h>
#include <exceptions/exceptions.h>
@@ -24,24 +26,34 @@ namespace isc {
namespace dns {
LabelSequence::LabelSequence(const void* buf) {
+#ifdef ENABLE_DEBUG
+ // In non-debug mode, derefencing the NULL pointer further below
+ // will lead to a crash, so disabling this check is not
+ // unsafe. Except for a programming mistake, this case should not
+ // happen.
if (buf == NULL) {
isc_throw(BadValue,
"Null pointer passed to LabelSequence constructor");
}
+#endif
const uint8_t* bp = reinterpret_cast<const uint8_t*>(buf);
-
first_label_ = 0;
const uint8_t offsets_len = *bp++;
+
+#ifdef ENABLE_DEBUG
if (offsets_len == 0 || offsets_len > Name::MAX_LABELS) {
isc_throw(BadValue,
"Bad offsets len in serialized LabelSequence data: "
<< static_cast<unsigned int>(offsets_len));
}
+#endif
+
last_label_ = offsets_len - 1;
offsets_ = bp;
data_ = bp + offsets_len;
+#ifdef ENABLE_DEBUG
// Check the integrity on the offsets and the name data
const uint8_t* dp = data_;
for (size_t cur_offset = 0; cur_offset < offsets_len; ++cur_offset) {
@@ -52,6 +64,7 @@ LabelSequence::LabelSequence(const void* buf) {
}
dp += (1 + *dp);
}
+#endif
}
LabelSequence::LabelSequence(const LabelSequence& src,
diff --git a/src/lib/dns/tests/labelsequence_unittest.cc b/src/lib/dns/tests/labelsequence_unittest.cc
index a3ac767..c211a4b 100644
--- a/src/lib/dns/tests/labelsequence_unittest.cc
+++ b/src/lib/dns/tests/labelsequence_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -12,6 +12,8 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <config.h>
+
#include <util/buffer.h>
#include <dns/labelsequence.h>
@@ -853,6 +855,10 @@ TEST_F(LabelSequenceTest, serialize) {
isc::BadValue);
}
+#ifdef ENABLE_DEBUG
+
+// These checks are enabled only in debug mode in the LabelSequence
+// class.
TEST_F(LabelSequenceTest, badDeserialize) {
EXPECT_THROW(LabelSequence(NULL), isc::BadValue);
const uint8_t zero_offsets[] = { 0 };
@@ -879,6 +885,8 @@ TEST_F(LabelSequenceTest, badDeserialize) {
EXPECT_THROW(LabelSequence ls(offsets_noincrease), isc::BadValue);
}
+#endif
+
namespace {
// Helper function; repeatedly calls
More information about the bind10-changes
mailing list