Test for match length exceeding lookahead in deflate stream

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-09-16 14:27:30 +02:00
committed by Vinnie Falco
parent 3d9ee6acee
commit fd57b0a73d

View File

@@ -441,6 +441,29 @@ public:
}
}
void
testRLEMatchLengthExceedLookahead()
{
z_params zp;
deflate_stream ds;
std::vector<std::uint8_t> in;
in.resize(300);
ds.reset(8, 15, 1, Strategy::rle);
std::fill_n(in.begin(), 4, 'a');
std::string out;
out.resize(in.size() * 2);
zp.next_in = in.data();
zp.avail_in = in.size();
zp.next_out = &out.front();
zp.avail_out = out.size();
error_code ec;
ds.write(zp, Flush::sync, ec);
BEAST_EXPECT(!ec);
}
void
run() override
{
@@ -453,6 +476,7 @@ public:
testWriteAfterFinish();
testFlushPartial();
testFlushAtLiteralBufferFull();
testRLEMatchLengthExceedLookahead();
}
};