BIND 10 master, updated. 25201656d56854345b11d4a3d553655da2a43bfa [master] changelog for #2764
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Mar 6 22:50:52 UTC 2013
The branch, master has been updated
via 25201656d56854345b11d4a3d553655da2a43bfa (commit)
via ca1da8aa5de24358d7d4e7e9a4625347457118cf (commit)
via 274ab7a8bd50c7d04214b97193c7461b99c2382e (commit)
via b48b9c7e0d0b51d399f248cb3387dbae770d157e (commit)
via dd41cb13ce276c055af55e486404773dfbf31154 (commit)
via f8a24304737fef27da9f2f4f8a02c1a558d6a34e (commit)
via 6c4f943e65aad695443076065082d40cfddbfe83 (commit)
from 6ae0d625f0571efa6482618636629e8e210a7718 (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 25201656d56854345b11d4a3d553655da2a43bfa
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Mar 6 14:50:46 2013 -0800
[master] changelog for #2764
commit ca1da8aa5de24358d7d4e7e9a4625347457118cf
Merge: 6ae0d62 274ab7a
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Wed Mar 6 14:43:56 2013 -0800
[master] Merge branch 'trac2764'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 9 +++
src/bin/cfgmgr/plugins/tests/tsig_keys_test.py | 2 +-
src/lib/util/encode/base_n.cc | 101 ++++++++++++++++++------
3 files changed, 85 insertions(+), 27 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 2c1f6bc..d6f5e8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+584. [bug] jinmei
+ Fixed build failure with Boost 1.53 (and probably higher) in the
+ internal utility library. Note that with -Werror it may still
+ fail, but it's due to a Boost bug that is reportedly fixed in their
+ development trunk. See https://svn.boost.org/trac/boost/ticket/8080
+ Until the fix is available in a released Boost version you may need
+ to specify the --without-werror configure option to build BIND 10.
+ (Trac #2764, git ca1da8aa5de24358d7d4e7e9a4625347457118cf)
+
583. [func]* jelte
b10-cmdctl-usermgr has been updated and its options and arguments
have changed; it now defaults to the same accounts file as
diff --git a/src/bin/cfgmgr/plugins/tests/tsig_keys_test.py b/src/bin/cfgmgr/plugins/tests/tsig_keys_test.py
index 808f28a..8c1639c 100644
--- a/src/bin/cfgmgr/plugins/tests/tsig_keys_test.py
+++ b/src/bin/cfgmgr/plugins/tests/tsig_keys_test.py
@@ -86,7 +86,7 @@ class TSigKeysTest(unittest.TestCase):
self.assertEqual("TSIG: Invalid TSIG key string: invalid.key",
tsig_keys.check({'keys': ['invalid.key']}))
self.assertEqual(
- "TSIG: Unexpected end of input in BASE decoder",
+ "TSIG: Incomplete input for base64: 123",
tsig_keys.check({'keys': ['invalid.key:123']}))
def test_bad_format(self):
diff --git a/src/lib/util/encode/base_n.cc b/src/lib/util/encode/base_n.cc
index c38f901..f5f930a 100644
--- a/src/lib/util/encode/base_n.cc
+++ b/src/lib/util/encode/base_n.cc
@@ -12,17 +12,6 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#include <stdint.h>
-#include <cassert>
-#include <iterator>
-#include <string>
-#include <vector>
-
-#include <boost/archive/iterators/base64_from_binary.hpp>
-#include <boost/archive/iterators/binary_from_base64.hpp>
-#include <boost/archive/iterators/transform_width.hpp>
-#include <boost/math/common_factor.hpp>
-
#include <util/encode/base32hex_from_binary.h>
#include <util/encode/binary_from_base32hex.h>
#include <util/encode/base16_from_binary.h>
@@ -32,6 +21,18 @@
#include <exceptions/exceptions.h>
+#include <boost/archive/iterators/base64_from_binary.hpp>
+#include <boost/archive/iterators/binary_from_base64.hpp>
+#include <boost/archive/iterators/transform_width.hpp>
+#include <boost/math/common_factor.hpp>
+
+#include <stdint.h>
+#include <stdexcept>
+#include <cassert>
+#include <iterator>
+#include <string>
+#include <vector>
+
using namespace std;
using namespace boost::archive::iterators;
@@ -110,15 +111,15 @@ public:
const vector<uint8_t>::const_iterator& base_end) :
base_(base), base_end_(base_end), in_pad_(false)
{}
- EncodeNormalizer& operator++() {
- if (!in_pad_) {
- ++base_;
- }
- if (base_ == base_end_) {
- in_pad_ = true;
- }
+ EncodeNormalizer& operator++() { // prefix version
+ increment();
return (*this);
}
+ EncodeNormalizer operator++(int) { // postfix version
+ const EncodeNormalizer copy = *this;
+ increment();
+ return (copy);
+ }
const uint8_t& operator*() const {
if (in_pad_) {
return (BINARY_ZERO_CODE);
@@ -130,11 +131,24 @@ public:
return (base_ == other.base_);
}
private:
+ void increment() {
+ if (!in_pad_) {
+ ++base_;
+ }
+ if (base_ == base_end_) {
+ in_pad_ = true;
+ }
+ }
vector<uint8_t>::const_iterator base_;
const vector<uint8_t>::const_iterator base_end_;
bool in_pad_;
};
+// An internally caught exception to unify a few possible cases of the same
+// error.
+class IncompleteBaseInput : public std::exception {
+};
+
// DecodeNormalizer is an input iterator intended to be used as a filter
// between the encoded baseX stream and binary_from_baseXX.
// A DecodeNormalizer object is configured with three string iterators
@@ -156,16 +170,20 @@ public:
DecodeNormalizer(const char base_zero_code,
const string::const_iterator& base,
const string::const_iterator& base_beginpad,
- const string::const_iterator& base_end) :
+ const string::const_iterator& base_end,
+ size_t* char_count) :
base_zero_code_(base_zero_code),
base_(base), base_beginpad_(base_beginpad), base_end_(base_end),
- in_pad_(false)
+ in_pad_(false), char_count_(char_count)
{
// Skip beginning spaces, if any. We need do it here because
// otherwise the first call to operator*() would be confused.
skipSpaces();
}
DecodeNormalizer& operator++() {
+ if (base_ < base_end_) {
+ ++*char_count_;
+ }
++base_;
skipSpaces();
if (base_ == base_beginpad_) {
@@ -188,15 +206,29 @@ public:
}
const char& operator*() const {
if (base_ == base_end_) {
- // binary_from_baseX calls this operator when it needs more bits
+ // binary_from_baseX can call this operator when it needs more bits
// even if the internal iterator (base_) has reached its end
// (if that happens it means the input is an incomplete baseX
// string and should be rejected). So this is the only point
// we can catch and reject this type of invalid input.
- isc_throw(BadValue, "Unexpected end of input in BASE decoder");
+ //
+ // More recent versions of Boost fixed the behavior and the
+ // out-of-range call to this operator doesn't happen. It's good,
+ // but in that case we need to catch incomplete baseX input in
+ // a different way. It's done via char_count_ and after the
+ // completion of decoding.
+ throw IncompleteBaseInput(); // throw this now and convert it
}
- if (in_pad_) {
- return (base_zero_code_);
+ if (*base_ == BASE_PADDING_CHAR) {
+ // Padding can only happen at the end of the input string. We can
+ // detect any violation of this by checking in_pad_, which is
+ // true iff we are on or after the first valid sequence of padding
+ // characters.
+ if (in_pad_) {
+ return (base_zero_code_);
+ } else {
+ isc_throw(BadValue, "Intermediate padding found");
+ }
} else {
return (*base_);
}
@@ -210,6 +242,9 @@ private:
const string::const_iterator base_beginpad_;
const string::const_iterator base_end_;
bool in_pad_;
+ // Store number of non-space decoded characters (incl. pad) here. Define
+ // it as a pointer so we can carry it over to any copied objects.
+ size_t* char_count_;
};
// BitsPerChunk: number of bits to be converted using the baseN mapping table.
@@ -331,10 +366,24 @@ BaseNTransformer<BitsPerChunk, BaseZeroCode, Encoder, Decoder>::decode(
const size_t padbytes = padbits / 8;
try {
+ size_t char_count = 0;
result.assign(Decoder(DecodeNormalizer(BaseZeroCode, input.begin(),
- srit.base(), input.end())),
+ srit.base(), input.end(),
+ &char_count)),
Decoder(DecodeNormalizer(BaseZeroCode, input.end(),
- input.end(), input.end())));
+ input.end(), input.end(),
+ NULL)));
+
+ // Number of bits of the conversion result including padding must be
+ // a multiple of 8; otherwise the decoder reaches the end of input
+ // with some incomplete bits of data, which is invalid.
+ if (((char_count * BitsPerChunk) % 8) != 0) {
+ throw IncompleteBaseInput(); // catch this immediately below
+ }
+ } catch (const IncompleteBaseInput&) {
+ // we unify error handling for incomplete input here.
+ isc_throw(BadValue, "Incomplete input for " << algorithm
+ << ": " << input);
} catch (const dataflow_exception& ex) {
// convert any boost exceptions into our local one.
isc_throw(BadValue, ex.what());
More information about the bind10-changes
mailing list