forked from boostorg/beast
@ -1397,7 +1397,7 @@ void
|
||||
deflate_stream::
|
||||
tr_tally_dist(std::uint16_t dist, std::uint8_t len, bool& flush)
|
||||
{
|
||||
sym_buf_[sym_next_++] = dist;
|
||||
sym_buf_[sym_next_++] = dist & 0xFF;
|
||||
sym_buf_[sym_next_++] = dist >> 8;
|
||||
sym_buf_[sym_next_++] = len;
|
||||
dist--;
|
||||
|
@ -502,8 +502,8 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
check(d, {0x63, 0x18, 0x05, 0x40, 0x0c, 0x00}, {}, 8, 3);
|
||||
check(d, {0xed, 0xc0, 0x81, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
check({0x63, 0x18, 0x05, 0x40, 0x0c, 0x00}, {}, 8, 3);
|
||||
check({0xed, 0xc0, 0x81, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
0xa0, 0xfd, 0xa9, 0x17, 0xa9, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@ -511,7 +511,7 @@ public:
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x06}, {});
|
||||
}
|
||||
|
||||
std::string check(IDecompressor& d,
|
||||
std::string check(
|
||||
std::initializer_list<std::uint8_t> const& in,
|
||||
error_code expected,
|
||||
std::size_t window_size = 15,
|
||||
@ -542,46 +542,46 @@ public:
|
||||
|
||||
void testInflateErrors(IDecompressor& d)
|
||||
{
|
||||
check(d, {0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
check({0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
error::invalid_stored_length);
|
||||
check(d, {0x03, 0x00},
|
||||
check({0x03, 0x00},
|
||||
error::end_of_stream);
|
||||
check(d, {0x06},
|
||||
check({0x06},
|
||||
error::invalid_block_type);
|
||||
check(d, {0xfc, 0x00, 0x00},
|
||||
check({0xfc, 0x00, 0x00},
|
||||
error::too_many_symbols);
|
||||
check(d, {0x04, 0x00, 0xfe, 0xff},
|
||||
check({0x04, 0x00, 0xfe, 0xff},
|
||||
error::incomplete_length_set);
|
||||
check(d, {0x04, 0x00, 0x24, 0x49, 0x00},
|
||||
check({0x04, 0x00, 0x24, 0x49, 0x00},
|
||||
error::invalid_bit_length_repeat);
|
||||
check(d, {0x04, 0x00, 0x24, 0xe9, 0xff, 0xff},
|
||||
check({0x04, 0x00, 0x24, 0xe9, 0xff, 0xff},
|
||||
error::invalid_bit_length_repeat);
|
||||
check(d, {0x04, 0x00, 0x24, 0xe9, 0xff, 0x6d},
|
||||
check({0x04, 0x00, 0x24, 0xe9, 0xff, 0x6d},
|
||||
error::missing_eob);
|
||||
check(d, {0x04, 0x80, 0x49, 0x92, 0x24, 0x49, 0x92, 0x24,
|
||||
check({0x04, 0x80, 0x49, 0x92, 0x24, 0x49, 0x92, 0x24,
|
||||
0x71, 0xff, 0xff, 0x93, 0x11, 0x00},
|
||||
error::over_subscribed_length);
|
||||
check(d, {0x04, 0x80, 0x49, 0x92, 0x24, 0x0f, 0xb4, 0xff,
|
||||
check({0x04, 0x80, 0x49, 0x92, 0x24, 0x0f, 0xb4, 0xff,
|
||||
0xff, 0xc3, 0x84},
|
||||
error::incomplete_length_set);
|
||||
check(d, {0x04, 0xc0, 0x81, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
check({0x04, 0xc0, 0x81, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
0x20, 0x7f, 0xeb, 0x0b, 0x00, 0x00},
|
||||
error::invalid_literal_length);
|
||||
check(d, {0x02, 0x7e, 0xff, 0xff},
|
||||
check({0x02, 0x7e, 0xff, 0xff},
|
||||
error::invalid_distance_code);
|
||||
check(d, {0x0c, 0xc0, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
check({0x0c, 0xc0, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x90, 0xff, 0x6b, 0x04, 0x00},
|
||||
error::invalid_distance);
|
||||
check(d, {0x05,0xe0, 0x81, 0x91, 0x24, 0xcb, 0xb2, 0x2c,
|
||||
check({0x05,0xe0, 0x81, 0x91, 0x24, 0xcb, 0xb2, 0x2c,
|
||||
0x49, 0xe2, 0x0f, 0x2e, 0x8b, 0x9a, 0x47, 0x56,
|
||||
0x9f, 0xfb, 0xfe, 0xec, 0xd2, 0xff, 0x1f},
|
||||
error::end_of_stream);
|
||||
check(d, {0xed, 0xc0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x40,
|
||||
check({0xed, 0xc0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x40,
|
||||
0x20, 0xff, 0x57, 0x1b, 0x42, 0x2c, 0x4f},
|
||||
error::end_of_stream);
|
||||
check(d, {0x02, 0x08, 0x20, 0x80, 0x00, 0x03, 0x00},
|
||||
check({0x02, 0x08, 0x20, 0x80, 0x00, 0x03, 0x00},
|
||||
error::end_of_stream);
|
||||
check(d, {0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x78, 0x9c, 0xff},
|
||||
check({0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x78, 0x9c, 0xff},
|
||||
error::invalid_stored_length);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user