merged RC_1_1 into master
This commit is contained in:
commit
2b91b1070d
|
@ -796,6 +796,7 @@ namespace {
|
||||||
std::int64_t len = t - '0';
|
std::int64_t len = t - '0';
|
||||||
char const* const str_start = start;
|
char const* const str_start = start;
|
||||||
++start;
|
++start;
|
||||||
|
if (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
|
||||||
bdecode_errors::error_code_enum e = bdecode_errors::no_error;
|
bdecode_errors::error_code_enum e = bdecode_errors::no_error;
|
||||||
start = parse_int(start, end, ':', len, e);
|
start = parse_int(start, end, ':', len, e);
|
||||||
if (e)
|
if (e)
|
||||||
|
|
|
@ -483,10 +483,10 @@ TORRENT_TEST(unepected_eof)
|
||||||
std::printf("%s\n", print_entry(e).c_str());
|
std::printf("%s\n", print_entry(e).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// test unexpected EOF (really expected terminator)
|
// test unexpected EOF in string length
|
||||||
TORRENT_TEST(unepected_eof2)
|
TORRENT_TEST(unepected_eof2)
|
||||||
{
|
{
|
||||||
char b[] = "l2:..0"; // expected terminating 'e' instead of '0'
|
char b[] = "l2:..0"; // expected ':' delimiter instead of EOF
|
||||||
|
|
||||||
bdecode_node e;
|
bdecode_node e;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
|
@ -494,7 +494,7 @@ TORRENT_TEST(unepected_eof2)
|
||||||
int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
|
int ret = bdecode(b, b + sizeof(b)-1, e, ec, &pos);
|
||||||
TEST_EQUAL(ret, -1);
|
TEST_EQUAL(ret, -1);
|
||||||
TEST_EQUAL(pos, 6);
|
TEST_EQUAL(pos, 6);
|
||||||
TEST_EQUAL(ec, error_code(bdecode_errors::expected_colon));
|
TEST_EQUAL(ec, error_code(bdecode_errors::unexpected_eof));
|
||||||
std::printf("%s\n", print_entry(e).c_str());
|
std::printf("%s\n", print_entry(e).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue