Commit cf2f1288 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

merged branches/177 (trac #177).

(with the usual prop change to rrsig_46.cc)


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1806 e5f2f494-b856-4b98-b285-d166d9295462
parent ae6a7bdc
......@@ -667,7 +667,7 @@ Name::reverse() const {
Name
Name::split(unsigned int first, unsigned int n) const {
if (n == 0 || first + n > labelcount_) {
if (n == 0 || n > labelcount_ || first > labelcount_ - n) {
isc_throw(OutOfRange, "Name::split: invalid split range");
}
......
......@@ -18,6 +18,7 @@
#include <string>
#include <sstream>
#include <iomanip>
#include <limits>
#include <stdexcept>
#include <dns/buffer.h>
......@@ -492,6 +493,11 @@ TEST_F(NameTest, split) {
// invalid range: an exception should be thrown.
EXPECT_THROW(example_name.split(1, 0), OutOfRange);
EXPECT_THROW(example_name.split(2, 3), OutOfRange);
// invalid range: the following parameters would cause overflow,
// bypassing naive validation.
EXPECT_THROW(example_name.split(1, numeric_limits<unsigned int>::max()),
OutOfRange);
}
TEST_F(NameTest, downcase) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment