mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
std/brotli: large-window mode, custom dictionaries and a fuzzer
Completes the decoder's feature set relative to libbrotlidec v1.2.1: - QUIRK_LARGE_WINDOW mirrors BROTLI_DECODER_PARAM_LARGE_WINDOW: the large-window WBITS escape, window bits up to 30, the 544-symbol distance alphabet and 64-bit distance arithmetic, with workbuf_len growing to (1 << 30) + 542 when the quirk is set. - decoder.add_dictionary! mirrors BrotliDecoderAttachDictionary for raw (LZ77 prefix) and serialized shared dictionaries: compound-dictionary distance mapping, the shared-dictionary parser (custom word lists, transform lists including the SHIFT transforms, context-dependent dictionary selection, prefix dictionaries) and all of its validation. Wuffs structs cannot hold slices, so the dictionary bytes are copied into the front of the caller's workbuf; the layout is documented in the README. Serialized dictionaries are accepted as in a BROTLI_EXPERIMENTAL build of libbrotli. - fuzz/c/std/brotli_fuzzer.c, exercising the quirk, dictionaries and random I/O limits. Tests: new golden vectors for large windows (including a 17 MiB far-distance stream generated in the test), raw and serialized dictionaries, nine more malformed inputs, and mimic comparisons that attach the same dictionaries to libbrotlidec. Differential runs over 2.7 million mutated large-window and dictionary streams found no divergence from libbrotlidec. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
This commit is contained in:
43 files changed
+4253
-460
No files matched your search
@@ -72,3 +72,75 @@ mimic_brotli_decode(wuffs_base__io_buffer* dst,
|
||||
int error_code = 0;
|
||||
return mimic_brotli_decode_error_code(dst, src, &error_code);
|
||||
}
|
||||
|
||||
// ---------------- Large Window and Dictionaries
|
||||
|
||||
#include "brotli/shared_dictionary.h"
|
||||
|
||||
// mimic_brotli_decode_with_options is like mimic_brotli_decode_error_code but
|
||||
// it also sets BROTLI_DECODER_PARAM_LARGE_WINDOW (if large_window is true) and
|
||||
// attaches dictionaries (with BrotliDecoderAttachDictionary). Each
|
||||
// dict_types[i] is a BrotliSharedDictionaryType value: 0 for
|
||||
// BROTLI_SHARED_DICTIONARY_RAW and 1 for BROTLI_SHARED_DICTIONARY_SERIALIZED.
|
||||
//
|
||||
// libbrotlidec only supports serialized dictionaries when built with
|
||||
// BROTLI_EXPERIMENTAL (which is not the default). When attaching a dictionary
|
||||
// fails, this function returns
|
||||
// mimic_brotli_attach_dictionary_failed_message.
|
||||
const char mimic_brotli_attach_dictionary_failed_message[] =
|
||||
"libbrotlidec: BrotliDecoderAttachDictionary failed";
|
||||
|
||||
const char* //
|
||||
mimic_brotli_decode_with_options(wuffs_base__io_buffer* dst,
|
||||
wuffs_base__io_buffer* src,
|
||||
bool large_window,
|
||||
size_t num_dicts,
|
||||
const uint32_t* dict_types,
|
||||
const wuffs_base__slice_u8* dicts,
|
||||
int* error_code_ptr) {
|
||||
*error_code_ptr = 0;
|
||||
BrotliDecoderState* state = BrotliDecoderCreateInstance(NULL, NULL, NULL);
|
||||
if (!state) {
|
||||
return "libbrotlidec: BrotliDecoderCreateInstance failed";
|
||||
}
|
||||
if (large_window &&
|
||||
!BrotliDecoderSetParameter(state, BROTLI_DECODER_PARAM_LARGE_WINDOW,
|
||||
1u)) {
|
||||
BrotliDecoderDestroyInstance(state);
|
||||
return "libbrotlidec: BrotliDecoderSetParameter failed";
|
||||
}
|
||||
for (size_t i = 0; i < num_dicts; i++) {
|
||||
if (!BrotliDecoderAttachDictionary(
|
||||
state, (BrotliSharedDictionaryType)dict_types[i], dicts[i].len,
|
||||
dicts[i].ptr)) {
|
||||
BrotliDecoderDestroyInstance(state);
|
||||
return mimic_brotli_attach_dictionary_failed_message;
|
||||
}
|
||||
}
|
||||
|
||||
size_t avail_in = wuffs_base__io_buffer__reader_length(src);
|
||||
const uint8_t* next_in = wuffs_base__io_buffer__reader_pointer(src);
|
||||
size_t avail_out = wuffs_base__io_buffer__writer_length(dst);
|
||||
uint8_t* next_out = wuffs_base__io_buffer__writer_pointer(dst);
|
||||
size_t total_out = 0;
|
||||
|
||||
BrotliDecoderResult result = BrotliDecoderDecompressStream(
|
||||
state, &avail_in, &next_in, &avail_out, &next_out, &total_out);
|
||||
*error_code_ptr = (int)BrotliDecoderGetErrorCode(state);
|
||||
BrotliDecoderDestroyInstance(state);
|
||||
|
||||
src->meta.ri += wuffs_base__io_buffer__reader_length(src) - avail_in;
|
||||
dst->meta.wi += wuffs_base__io_buffer__writer_length(dst) - avail_out;
|
||||
|
||||
switch (result) {
|
||||
case BROTLI_DECODER_RESULT_SUCCESS:
|
||||
return NULL;
|
||||
case BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:
|
||||
return "libbrotlidec: needs more input";
|
||||
case BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:
|
||||
return "libbrotlidec: needs more output";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "libbrotlidec: BrotliDecoderDecompressStream failed";
|
||||
}
|
||||
@@ -538,6 +538,7 @@ brotli_c_error_code(const char* status) {
|
||||
{wuffs_brotli__error__bad_final_padding, -15},
|
||||
{wuffs_brotli__error__bad_distance, -16},
|
||||
{wuffs_brotli__error__bad_block_switch, -17},
|
||||
{wuffs_brotli__error__bad_compound_dictionary, -18},
|
||||
{wuffs_brotli__error__truncated_input, 2},
|
||||
};
|
||||
if (!status) {
|
||||
@@ -633,6 +634,855 @@ test_mimic_brotli_decode_malformed() {
|
||||
|
||||
#endif // WUFFS_MIMIC
|
||||
|
||||
// ---------------- Large Window and Dictionary Tests
|
||||
|
||||
// See test/data/brotli/README.md for where the large-window (lw), raw
|
||||
// dictionary (raw) and serialized shared dictionary (sd) test files came from.
|
||||
|
||||
typedef struct {
|
||||
uint32_t type; // WUFFS_BROTLI__DICTIONARY_TYPE_ETC.
|
||||
const char* filename;
|
||||
// lo and hi select the [lo .. hi) bytes of the file. A zero hi means the
|
||||
// whole file.
|
||||
size_t lo;
|
||||
size_t hi;
|
||||
} brotli_dict_spec;
|
||||
|
||||
#define BROTLI_DICT_SPECS_MAX 4
|
||||
|
||||
// g_brotli_dict_sets lists the sets of dictionaries (attached in order) that
|
||||
// the test files use. A NULL filename terminates each set.
|
||||
struct {
|
||||
brotli_dict_spec specs[BROTLI_DICT_SPECS_MAX];
|
||||
} g_brotli_dict_sets[] = {
|
||||
#define BROTLI_DICT_SET_NONE 0
|
||||
{{{0, NULL, 0, 0}}},
|
||||
#define BROTLI_DICT_SET_RAW_ROMEO 1
|
||||
{{{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/romeo.txt", 0, 0}}},
|
||||
#define BROTLI_DICT_SET_RAW_ALICE_CHUNKS 2
|
||||
{{
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/brotli/alice29.txt", 0,
|
||||
20000},
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/brotli/alice29.txt",
|
||||
20000, 20001},
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/brotli/alice29.txt",
|
||||
20001, 20001},
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/brotli/alice29.txt",
|
||||
20001, 60000},
|
||||
}},
|
||||
#define BROTLI_DICT_SET_RAW_ROMEO_CHUNKS 3
|
||||
{{
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/romeo.txt", 0, 300},
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/romeo.txt", 300, 500},
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/romeo.txt", 500, 942},
|
||||
}},
|
||||
#define BROTLI_DICT_SET_SD_FULL 4
|
||||
{{{WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED,
|
||||
"test/data/brotli/shared-dictionary.full.bin", 0, 0}}},
|
||||
#define BROTLI_DICT_SET_SD_WORDS 5
|
||||
{{{WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED,
|
||||
"test/data/brotli/shared-dictionary.words.bin", 0, 0}}},
|
||||
#define BROTLI_DICT_SET_SD_PREFIX_AND_RAW 6
|
||||
{{
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED,
|
||||
"test/data/brotli/shared-dictionary.prefix.bin", 0, 0},
|
||||
{WUFFS_BROTLI__DICTIONARY_TYPE_RAW, "test/data/romeo.txt", 0, 300},
|
||||
}},
|
||||
#define BROTLI_DICT_SET_SD_UTF8 7
|
||||
{{{WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED,
|
||||
"test/data/brotli/shared-dictionary.utf8.bin", 0, 0}}},
|
||||
};
|
||||
|
||||
// g_brotli_ext_vectors lists (compressed, decompressed) pairs of test files
|
||||
// that need the large-window quirk or attached dictionaries.
|
||||
struct {
|
||||
const char* src_filename;
|
||||
const char* want_filename;
|
||||
bool large_window;
|
||||
size_t dict_set;
|
||||
} g_brotli_ext_vectors[] = {
|
||||
{"test/data/brotli/alice29.txt.q11lw26.br", "test/data/brotli/alice29.txt",
|
||||
true, BROTLI_DICT_SET_NONE},
|
||||
{"test/data/brotli/alice29.txt.q5lw10.br", "test/data/brotli/alice29.txt",
|
||||
true, BROTLI_DICT_SET_NONE},
|
||||
{"test/data/brotli/romeo.txt.q11lw30.br", "test/data/romeo.txt", true,
|
||||
BROTLI_DICT_SET_NONE},
|
||||
{"test/data/brotli/romeo.txt.q9lw28.br", "test/data/romeo.txt", true,
|
||||
BROTLI_DICT_SET_NONE},
|
||||
{"test/data/brotli/romeo.txt.q11w22.raw-romeo.br", "test/data/romeo.txt",
|
||||
false, BROTLI_DICT_SET_RAW_ROMEO},
|
||||
{"test/data/brotli/romeo.txt.q11lw30.raw-romeo.br", "test/data/romeo.txt",
|
||||
true, BROTLI_DICT_SET_RAW_ROMEO},
|
||||
{"test/data/brotli/alice29.txt.q5w18.raw-chunks.br",
|
||||
"test/data/brotli/alice29.txt", false, BROTLI_DICT_SET_RAW_ALICE_CHUNKS},
|
||||
{"test/data/brotli/alice29.txt.q11w18.raw-chunks.br",
|
||||
"test/data/brotli/alice29.txt", false, BROTLI_DICT_SET_RAW_ALICE_CHUNKS},
|
||||
{"test/data/brotli/romeo.txt.q11w16.raw-chunks.br", "test/data/romeo.txt",
|
||||
false, BROTLI_DICT_SET_RAW_ROMEO_CHUNKS},
|
||||
{"test/data/brotli/shared-dictionary.text.q5w18.sd-full.br",
|
||||
"test/data/brotli/shared-dictionary.text", false, BROTLI_DICT_SET_SD_FULL},
|
||||
{"test/data/brotli/shared-dictionary.text.q11w18.sd-full.br",
|
||||
"test/data/brotli/shared-dictionary.text", false, BROTLI_DICT_SET_SD_FULL},
|
||||
{"test/data/brotli/shared-dictionary.text.q11lw24.sd-full.br",
|
||||
"test/data/brotli/shared-dictionary.text", true, BROTLI_DICT_SET_SD_FULL},
|
||||
{"test/data/brotli/alice29.txt.q11w22.sd-words.br",
|
||||
"test/data/brotli/alice29.txt", false, BROTLI_DICT_SET_SD_WORDS},
|
||||
{"test/data/brotli/asyoulik.txt.q11w18.sd-prefix-raw.br",
|
||||
"test/data/brotli/asyoulik.txt", false, BROTLI_DICT_SET_SD_PREFIX_AND_RAW},
|
||||
{"test/data/brotli/romeo-mutated.sd-utf8.br",
|
||||
"test/data/brotli/romeo-mutated.sd-utf8.txt", false,
|
||||
BROTLI_DICT_SET_SD_UTF8},
|
||||
};
|
||||
|
||||
// g_brotli_ext_malformed is like g_brotli_malformed but for inputs that need
|
||||
// the large-window quirk or attached dictionaries. The invalid.lw-*,
|
||||
// invalid.raw-* and invalid.sd-* files were found by mutating the
|
||||
// g_brotli_ext_vectors files (see test/data/brotli/README.md).
|
||||
struct {
|
||||
const char* src_filename;
|
||||
const char* data;
|
||||
size_t len;
|
||||
bool large_window;
|
||||
size_t dict_set;
|
||||
const char* want_status;
|
||||
} g_brotli_ext_malformed[] = {
|
||||
// BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: the large-window escape
|
||||
// followed by a non-zero reserved bit.
|
||||
{NULL, "\x91", 1, true, BROTLI_DICT_SET_NONE,
|
||||
wuffs_brotli__error__bad_window_bits},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: large-window WBITS of 9 (too
|
||||
// small) and 62 (too large).
|
||||
{NULL, "\x11\x09", 2, true, BROTLI_DICT_SET_NONE,
|
||||
wuffs_brotli__error__bad_window_bits},
|
||||
{NULL, "\x11\x3E", 2, true, BROTLI_DICT_SET_NONE,
|
||||
wuffs_brotli__error__bad_window_bits},
|
||||
// BROTLI_DECODER_NEEDS_MORE_INPUT: a truncated large-window header.
|
||||
{NULL, "\x11", 1, true, BROTLI_DICT_SET_NONE,
|
||||
wuffs_brotli__error__truncated_input},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: a large-window stream without
|
||||
// the large-window quirk.
|
||||
{"test/data/brotli/romeo.txt.q11lw30.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_NONE, wuffs_brotli__error__unsupported_large_window},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_DISTANCE.
|
||||
{"test/data/brotli/invalid.lw-distance.br", NULL, 0, true,
|
||||
BROTLI_DICT_SET_NONE, wuffs_brotli__error__bad_distance},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_DICTIONARY.
|
||||
{"test/data/brotli/invalid.lw-dictionary.br", NULL, 0, true,
|
||||
BROTLI_DICT_SET_NONE, wuffs_brotli__error__bad_dictionary},
|
||||
// BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY.
|
||||
{"test/data/brotli/invalid.raw-compound-dictionary.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_RAW_ROMEO_CHUNKS,
|
||||
wuffs_brotli__error__bad_compound_dictionary},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_DICTIONARY.
|
||||
{"test/data/brotli/invalid.raw-dictionary.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_RAW_ROMEO_CHUNKS, wuffs_brotli__error__bad_dictionary},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_TRANSFORM.
|
||||
{"test/data/brotli/invalid.raw-transform.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_RAW_ROMEO_CHUNKS, wuffs_brotli__error__bad_transform},
|
||||
// BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY: a stream compressed without
|
||||
// a dictionary refers to the static dictionary, but with a compound
|
||||
// dictionary attached, the same distance refers to the compound
|
||||
// dictionary.
|
||||
{"test/data/brotli/romeo.txt.q11w22.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_SD_FULL, wuffs_brotli__error__bad_compound_dictionary},
|
||||
// BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY.
|
||||
{"test/data/brotli/invalid.sd-compound-dictionary.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_SD_FULL, wuffs_brotli__error__bad_compound_dictionary},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_DICTIONARY.
|
||||
{"test/data/brotli/invalid.sd-dictionary.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_SD_FULL, wuffs_brotli__error__bad_dictionary},
|
||||
// BROTLI_DECODER_ERROR_FORMAT_TRANSFORM.
|
||||
{"test/data/brotli/invalid.sd-transform.br", NULL, 0, false,
|
||||
BROTLI_DICT_SET_SD_FULL, wuffs_brotli__error__bad_transform},
|
||||
{"test/data/brotli/invalid.lw-sd-transform.br", NULL, 0, true,
|
||||
BROTLI_DICT_SET_SD_FULL, wuffs_brotli__error__bad_transform},
|
||||
};
|
||||
|
||||
// g_brotli_dict_arrays holds the dictionaries' bytes.
|
||||
uint8_t g_brotli_dict_arrays[BROTLI_DICT_SPECS_MAX][256 * 1024];
|
||||
|
||||
// load_brotli_dict_set loads the dict_set'th g_brotli_dict_sets entry.
|
||||
const char* //
|
||||
load_brotli_dict_set(size_t dict_set,
|
||||
size_t* num_dicts,
|
||||
uint32_t* dict_types,
|
||||
wuffs_base__slice_u8* dicts) {
|
||||
*num_dicts = 0;
|
||||
if (dict_set >= WUFFS_TESTLIB_ARRAY_SIZE(g_brotli_dict_sets)) {
|
||||
return "load_brotli_dict_set: dict_set out of range";
|
||||
}
|
||||
for (size_t i = 0; i < BROTLI_DICT_SPECS_MAX; i++) {
|
||||
const brotli_dict_spec* spec = &g_brotli_dict_sets[dict_set].specs[i];
|
||||
if (!spec->filename) {
|
||||
break;
|
||||
}
|
||||
wuffs_base__io_buffer buf = ((wuffs_base__io_buffer){
|
||||
.data = wuffs_base__make_slice_u8(g_brotli_dict_arrays[i],
|
||||
sizeof g_brotli_dict_arrays[i]),
|
||||
});
|
||||
CHECK_STRING(read_file(&buf, spec->filename));
|
||||
size_t hi = spec->hi ? spec->hi : buf.meta.wi;
|
||||
if ((spec->lo > hi) || (hi > buf.meta.wi)) {
|
||||
return "load_brotli_dict_set: bad lo/hi";
|
||||
}
|
||||
dict_types[i] = spec->type;
|
||||
dicts[i] = wuffs_base__make_slice_u8(buf.data.ptr + spec->lo,
|
||||
hi - spec->lo);
|
||||
*num_dicts = i + 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// get_brotli_big_workbuf sets *workbuf to a malloc'ed buffer that is large
|
||||
// enough for any large-window stream and 1 MiB of dictionaries. It is never
|
||||
// freed. Only the parts of it that the decoder uses are touched, so the
|
||||
// operating system should only need to commit as much memory as the stream's
|
||||
// window size.
|
||||
const char* //
|
||||
get_brotli_big_workbuf(wuffs_base__slice_u8* workbuf) {
|
||||
static uint8_t* ptr = NULL;
|
||||
const size_t n = WUFFS_BROTLI__DECODER_WORKBUF_LEN_LARGE_WINDOW + (1 << 20);
|
||||
if (!ptr) {
|
||||
ptr = (uint8_t*)malloc(n);
|
||||
if (!ptr) {
|
||||
return "get_brotli_big_workbuf: out of memory";
|
||||
}
|
||||
}
|
||||
*workbuf = wuffs_base__make_slice_u8(ptr, n);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// wuffs_brotli_decode_with_options is like wuffs_brotli_decode but it can
|
||||
// also set the large-window quirk and attach dictionaries.
|
||||
const char* //
|
||||
wuffs_brotli_decode_with_options(wuffs_base__io_buffer* dst,
|
||||
wuffs_base__io_buffer* src,
|
||||
uint64_t wlimit,
|
||||
uint64_t rlimit,
|
||||
bool large_window,
|
||||
size_t dict_set) {
|
||||
size_t num_dicts = 0;
|
||||
uint32_t dict_types[BROTLI_DICT_SPECS_MAX] = {0};
|
||||
wuffs_base__slice_u8 dicts[BROTLI_DICT_SPECS_MAX] = {0};
|
||||
CHECK_STRING(load_brotli_dict_set(dict_set, &num_dicts, dict_types, dicts));
|
||||
|
||||
wuffs_brotli__decoder dec;
|
||||
CHECK_STATUS("initialize",
|
||||
wuffs_brotli__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
|
||||
// The large-window workbuf_len (more than 1 GiB) is larger than
|
||||
// g_work_slice_u8.
|
||||
wuffs_base__slice_u8 workbuf = g_work_slice_u8;
|
||||
if (large_window) {
|
||||
CHECK_STATUS("set_quirk",
|
||||
wuffs_brotli__decoder__set_quirk(
|
||||
&dec, WUFFS_BROTLI__QUIRK_LARGE_WINDOW, 1));
|
||||
CHECK_STRING(get_brotli_big_workbuf(&workbuf));
|
||||
}
|
||||
for (size_t i = 0; i < num_dicts; i++) {
|
||||
CHECK_STATUS("add_dictionary",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, dict_types[i], dicts[i], workbuf));
|
||||
}
|
||||
wuffs_base__range_ii_u64 workbuf_len =
|
||||
wuffs_brotli__decoder__workbuf_len(&dec);
|
||||
if (workbuf_len.max_incl > workbuf.len) {
|
||||
return "workbuf_len is too large";
|
||||
}
|
||||
workbuf.len = workbuf_len.max_incl;
|
||||
|
||||
while (true) {
|
||||
wuffs_base__io_buffer limited_dst = make_limited_writer(*dst, wlimit);
|
||||
wuffs_base__io_buffer limited_src = make_limited_reader(*src, rlimit);
|
||||
|
||||
wuffs_base__status status = wuffs_brotli__decoder__transform_io(
|
||||
&dec, &limited_dst, &limited_src, workbuf);
|
||||
|
||||
dst->meta.wi += limited_dst.meta.wi;
|
||||
src->meta.ri += limited_src.meta.ri;
|
||||
|
||||
if (((wlimit < UINT64_MAX) &&
|
||||
(status.repr == wuffs_base__suspension__short_write)) ||
|
||||
((rlimit < UINT64_MAX) &&
|
||||
(status.repr == wuffs_base__suspension__short_read))) {
|
||||
continue;
|
||||
}
|
||||
return status.repr;
|
||||
}
|
||||
}
|
||||
|
||||
const char* //
|
||||
do_test_brotli_decode_ext_all(uint64_t wlimit, uint64_t rlimit) {
|
||||
size_t n = WUFFS_TESTLIB_ARRAY_SIZE(g_brotli_ext_vectors);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer have = ((wuffs_base__io_buffer){
|
||||
.data = g_have_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer want = ((wuffs_base__io_buffer){
|
||||
.data = g_want_slice_u8,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, g_brotli_ext_vectors[i].src_filename));
|
||||
CHECK_STRING(read_file(&want, g_brotli_ext_vectors[i].want_filename));
|
||||
const char* status = wuffs_brotli_decode_with_options(
|
||||
&have, &src, wlimit, rlimit, g_brotli_ext_vectors[i].large_window,
|
||||
g_brotli_ext_vectors[i].dict_set);
|
||||
if (status) {
|
||||
RETURN_FAIL("%s: %s", g_brotli_ext_vectors[i].src_filename, status);
|
||||
}
|
||||
status = check_io_buffers_equal("", &have, &want);
|
||||
if (status) {
|
||||
RETURN_FAIL("%s: %s", g_brotli_ext_vectors[i].src_filename, status);
|
||||
}
|
||||
if (src.meta.ri != src.meta.wi) {
|
||||
RETURN_FAIL("%s: ri: have %zu, want %zu",
|
||||
g_brotli_ext_vectors[i].src_filename, src.meta.ri,
|
||||
src.meta.wi);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_brotli_decode_ext_all() {
|
||||
CHECK_FOCUS(__func__);
|
||||
return do_test_brotli_decode_ext_all(UINT64_MAX, UINT64_MAX);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_brotli_decode_ext_all_with_io_limits() {
|
||||
CHECK_FOCUS(__func__);
|
||||
return do_test_brotli_decode_ext_all(1, 1);
|
||||
}
|
||||
|
||||
// make_brotli_far_data writes the decompressed form of
|
||||
// test/data/brotli/far17m.q9lw25.br: 64 KiB of xorshift32 output, 17 MiB of
|
||||
// zeroes and the same 64 KiB again. Its second 64 KiB copy is more than
|
||||
// (1 << 24) bytes after the first.
|
||||
const char* //
|
||||
make_brotli_far_data(wuffs_base__io_buffer* dst) {
|
||||
const size_t a = 65536;
|
||||
const size_t z = 17 << 20;
|
||||
if ((dst->data.len - dst->meta.wi) < (a + z + a)) {
|
||||
return "make_brotli_far_data: dst is too short";
|
||||
}
|
||||
uint8_t* p = dst->data.ptr + dst->meta.wi;
|
||||
uint32_t x = 0x12345678;
|
||||
for (size_t i = 0; i < a; i++) {
|
||||
x ^= x << 13;
|
||||
x ^= x >> 17;
|
||||
x ^= x << 5;
|
||||
p[i] = (uint8_t)(x >> 24);
|
||||
}
|
||||
memset(p + a, 0, z);
|
||||
memcpy(p + a + z, p, a);
|
||||
dst->meta.wi += a + z + a;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
do_test_brotli_decode_large_window_far(
|
||||
const char* (*codec_func)(wuffs_base__io_buffer*,
|
||||
wuffs_base__io_buffer*,
|
||||
uint64_t,
|
||||
uint64_t,
|
||||
bool,
|
||||
size_t),
|
||||
uint64_t wlimit,
|
||||
uint64_t rlimit) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer have = ((wuffs_base__io_buffer){
|
||||
.data = g_have_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer want = ((wuffs_base__io_buffer){
|
||||
.data = g_want_slice_u8,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, "test/data/brotli/far17m.q9lw25.br"));
|
||||
CHECK_STRING(make_brotli_far_data(&want));
|
||||
CHECK_STRING(
|
||||
(*codec_func)(&have, &src, wlimit, rlimit, true, BROTLI_DICT_SET_NONE));
|
||||
return check_io_buffers_equal("", &have, &want);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_brotli_decode_large_window_far() {
|
||||
CHECK_FOCUS(__func__);
|
||||
CHECK_STRING(do_test_brotli_decode_large_window_far(
|
||||
wuffs_brotli_decode_with_options, UINT64_MAX, UINT64_MAX));
|
||||
return do_test_brotli_decode_large_window_far(
|
||||
wuffs_brotli_decode_with_options, 4099, 113);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_brotli_decode_large_window_quirk() {
|
||||
CHECK_FOCUS(__func__);
|
||||
|
||||
// With the quirk set, standard (not large-window) streams still decode.
|
||||
size_t n = WUFFS_TESTLIB_ARRAY_SIZE(g_brotli_vectors);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer have = ((wuffs_base__io_buffer){
|
||||
.data = g_have_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer want = ((wuffs_base__io_buffer){
|
||||
.data = g_want_slice_u8,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, g_brotli_vectors[i].src_filename));
|
||||
CHECK_STRING(read_file(&want, g_brotli_vectors[i].want_filename));
|
||||
const char* status = wuffs_brotli_decode_with_options(
|
||||
&have, &src, UINT64_MAX, UINT64_MAX, true, BROTLI_DICT_SET_NONE);
|
||||
if (status) {
|
||||
RETURN_FAIL("%s: %s", g_brotli_vectors[i].src_filename, status);
|
||||
}
|
||||
CHECK_STRING(check_io_buffers_equal("", &have, &want));
|
||||
}
|
||||
|
||||
// The quirk's value and the workbuf_len.
|
||||
wuffs_brotli__decoder dec;
|
||||
CHECK_STATUS("initialize", wuffs_brotli__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__DEFAULT_OPTIONS));
|
||||
if (wuffs_brotli__decoder__get_quirk(&dec,
|
||||
WUFFS_BROTLI__QUIRK_LARGE_WINDOW) != 0) {
|
||||
RETURN_FAIL("get_quirk #0: have non-zero, want zero");
|
||||
}
|
||||
wuffs_base__range_ii_u64 r = wuffs_brotli__decoder__workbuf_len(&dec);
|
||||
if ((r.min_incl != WUFFS_BROTLI__DECODER_WORKBUF_LEN_STANDARD) ||
|
||||
(r.max_incl != WUFFS_BROTLI__DECODER_WORKBUF_LEN_STANDARD) ||
|
||||
(r.max_incl != ((1 << 24) + 542))) {
|
||||
RETURN_FAIL("workbuf_len #0: have %" PRIu64, r.max_incl);
|
||||
}
|
||||
CHECK_STATUS("set_quirk", wuffs_brotli__decoder__set_quirk(
|
||||
&dec, WUFFS_BROTLI__QUIRK_LARGE_WINDOW, 1));
|
||||
if (wuffs_brotli__decoder__get_quirk(&dec,
|
||||
WUFFS_BROTLI__QUIRK_LARGE_WINDOW) != 1) {
|
||||
RETURN_FAIL("get_quirk #1: have zero, want non-zero");
|
||||
}
|
||||
r = wuffs_brotli__decoder__workbuf_len(&dec);
|
||||
if ((r.min_incl != r.max_incl) ||
|
||||
(r.max_incl != WUFFS_BROTLI__DECODER_WORKBUF_LEN_LARGE_WINDOW) ||
|
||||
(r.max_incl != ((1 << 30) + 542))) {
|
||||
RETURN_FAIL("workbuf_len #1: have %" PRIu64, r.max_incl);
|
||||
}
|
||||
|
||||
// Quirks cannot be set after decoding has started.
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer have = ((wuffs_base__io_buffer){
|
||||
.data = g_have_slice_u8,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, "test/data/brotli/alice29.txt.q5lw10.br"));
|
||||
src.meta.wi = 3;
|
||||
src.meta.closed = false;
|
||||
wuffs_base__slice_u8 workbuf = g_work_slice_u8;
|
||||
wuffs_base__status status =
|
||||
wuffs_brotli__decoder__transform_io(&dec, &have, &src, workbuf);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
RETURN_FAIL("transform_io: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__suspension__short_read);
|
||||
}
|
||||
status = wuffs_brotli__decoder__set_quirk(
|
||||
&dec, WUFFS_BROTLI__QUIRK_LARGE_WINDOW, 0);
|
||||
if (status.repr != wuffs_base__error__bad_call_sequence) {
|
||||
RETURN_FAIL("set_quirk: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__error__bad_call_sequence);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_brotli_decode_ext_malformed() {
|
||||
CHECK_FOCUS(__func__);
|
||||
size_t n = WUFFS_TESTLIB_ARRAY_SIZE(g_brotli_ext_malformed);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer have = ((wuffs_base__io_buffer){
|
||||
.data = g_have_slice_u8,
|
||||
});
|
||||
if (g_brotli_ext_malformed[i].src_filename) {
|
||||
CHECK_STRING(read_file(&src, g_brotli_ext_malformed[i].src_filename));
|
||||
} else {
|
||||
memcpy(src.data.ptr, g_brotli_ext_malformed[i].data,
|
||||
g_brotli_ext_malformed[i].len);
|
||||
src.meta.wi = g_brotli_ext_malformed[i].len;
|
||||
src.meta.closed = true;
|
||||
}
|
||||
uint64_t limit = (j == 0) ? UINT64_MAX : 1;
|
||||
const char* have_status = wuffs_brotli_decode_with_options(
|
||||
&have, &src, limit, limit, g_brotli_ext_malformed[i].large_window,
|
||||
g_brotli_ext_malformed[i].dict_set);
|
||||
const char* want_status = g_brotli_ext_malformed[i].want_status;
|
||||
if (have_status != want_status) {
|
||||
RETURN_FAIL("i=%zu, j=%d: have \"%s\", want \"%s\"", i, j, have_status,
|
||||
want_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_brotli_add_dictionary() {
|
||||
CHECK_FOCUS(__func__);
|
||||
wuffs_base__io_buffer full = ((wuffs_base__io_buffer){
|
||||
.data = wuffs_base__make_slice_u8(g_brotli_dict_arrays[0],
|
||||
sizeof g_brotli_dict_arrays[0]),
|
||||
});
|
||||
wuffs_base__io_buffer words = ((wuffs_base__io_buffer){
|
||||
.data = wuffs_base__make_slice_u8(g_brotli_dict_arrays[1],
|
||||
sizeof g_brotli_dict_arrays[1]),
|
||||
});
|
||||
wuffs_base__io_buffer prefix = ((wuffs_base__io_buffer){
|
||||
.data = wuffs_base__make_slice_u8(g_brotli_dict_arrays[2],
|
||||
sizeof g_brotli_dict_arrays[2]),
|
||||
});
|
||||
CHECK_STRING(
|
||||
read_file(&full, "test/data/brotli/shared-dictionary.full.bin"));
|
||||
CHECK_STRING(
|
||||
read_file(&words, "test/data/brotli/shared-dictionary.words.bin"));
|
||||
CHECK_STRING(
|
||||
read_file(&prefix, "test/data/brotli/shared-dictionary.prefix.bin"));
|
||||
wuffs_base__slice_u8 full_s =
|
||||
wuffs_base__make_slice_u8(full.data.ptr, full.meta.wi);
|
||||
wuffs_base__slice_u8 words_s =
|
||||
wuffs_base__make_slice_u8(words.data.ptr, words.meta.wi);
|
||||
wuffs_base__slice_u8 prefix_s =
|
||||
wuffs_base__make_slice_u8(prefix.data.ptr, prefix.meta.wi);
|
||||
wuffs_base__slice_u8 raw_s =
|
||||
wuffs_base__make_slice_u8(prefix.data.ptr, 100);
|
||||
wuffs_base__slice_u8 workbuf = g_work_slice_u8;
|
||||
wuffs_brotli__decoder dec;
|
||||
wuffs_base__status status;
|
||||
|
||||
// An unknown dictionary type.
|
||||
CHECK_STATUS("initialize", wuffs_brotli__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__DEFAULT_OPTIONS));
|
||||
status = wuffs_brotli__decoder__add_dictionary(&dec, 2, raw_s, workbuf);
|
||||
if (status.repr != wuffs_base__error__bad_argument) {
|
||||
RETURN_FAIL("type 2: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__error__bad_argument);
|
||||
}
|
||||
|
||||
// At most 15 compound (raw or prefix) dictionaries. The workbuf_len grows
|
||||
// with each one.
|
||||
for (int i = 0; i < 15; i++) {
|
||||
CHECK_STATUS("add_dictionary #0",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_RAW, raw_s, workbuf));
|
||||
wuffs_base__range_ii_u64 r = wuffs_brotli__decoder__workbuf_len(&dec);
|
||||
uint64_t want = WUFFS_BROTLI__DECODER_WORKBUF_LEN_STANDARD +
|
||||
(100 * ((uint64_t)i + 1));
|
||||
if ((r.min_incl != want) || (r.max_incl != want)) {
|
||||
RETURN_FAIL("workbuf_len: have %" PRIu64 ", want %" PRIu64, r.max_incl,
|
||||
want);
|
||||
}
|
||||
}
|
||||
status = wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_RAW, raw_s, workbuf);
|
||||
if (status.repr != wuffs_brotli__error__too_many_compound_dictionaries) {
|
||||
RETURN_FAIL("16th raw: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_brotli__error__too_many_compound_dictionaries);
|
||||
}
|
||||
status = wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED, prefix_s, workbuf);
|
||||
if (status.repr != wuffs_brotli__error__too_many_compound_dictionaries) {
|
||||
RETURN_FAIL("16th prefix: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_brotli__error__too_many_compound_dictionaries);
|
||||
}
|
||||
// A serialized dictionary without a prefix is still OK.
|
||||
CHECK_STATUS("add_dictionary #1",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED, words_s,
|
||||
workbuf));
|
||||
|
||||
// Only one serialized dictionary can have custom word or transform lists,
|
||||
// but a serialized dictionary without them (only a prefix) is OK.
|
||||
CHECK_STATUS("initialize", wuffs_brotli__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__DEFAULT_OPTIONS));
|
||||
CHECK_STATUS("add_dictionary #2",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED, full_s,
|
||||
workbuf));
|
||||
status = wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED, words_s, workbuf);
|
||||
if (status.repr !=
|
||||
wuffs_brotli__error__unsupported_multiple_custom_static_dictionaries) {
|
||||
RETURN_FAIL(
|
||||
"words after full: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_brotli__error__unsupported_multiple_custom_static_dictionaries);
|
||||
}
|
||||
CHECK_STATUS("add_dictionary #3",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED, prefix_s,
|
||||
workbuf));
|
||||
// Attaching a prefix-only serialized dictionary resets the static
|
||||
// dictionary to the built-in one, so custom lists can be attached again.
|
||||
CHECK_STATUS("add_dictionary #4",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED, words_s,
|
||||
workbuf));
|
||||
|
||||
// Invalid serialized dictionaries: every proper prefix of a valid one, and
|
||||
// a bad magic number. A failed add_dictionary does not change the
|
||||
// workbuf_len.
|
||||
CHECK_STATUS("initialize", wuffs_brotli__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__DEFAULT_OPTIONS));
|
||||
for (size_t i = 0; i < full_s.len; i++) {
|
||||
status = wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED,
|
||||
wuffs_base__make_slice_u8(full_s.ptr, i), workbuf);
|
||||
if (status.repr != wuffs_brotli__error__bad_shared_dictionary) {
|
||||
RETURN_FAIL("prefix length %zu: have \"%s\", want \"%s\"", i,
|
||||
status.repr, wuffs_brotli__error__bad_shared_dictionary);
|
||||
}
|
||||
}
|
||||
full_s.ptr[0] ^= 1;
|
||||
status = wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_SERIALIZED, full_s, workbuf);
|
||||
full_s.ptr[0] ^= 1;
|
||||
if (status.repr != wuffs_brotli__error__bad_shared_dictionary) {
|
||||
RETURN_FAIL("bad magic: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_brotli__error__bad_shared_dictionary);
|
||||
}
|
||||
if (wuffs_brotli__decoder__workbuf_len(&dec).max_incl !=
|
||||
WUFFS_BROTLI__DECODER_WORKBUF_LEN_STANDARD) {
|
||||
RETURN_FAIL("workbuf_len changed");
|
||||
}
|
||||
|
||||
// A too-short workbuf.
|
||||
status = wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_RAW, raw_s,
|
||||
wuffs_base__make_slice_u8(workbuf.ptr, 99));
|
||||
if (status.repr != wuffs_base__error__bad_workbuf_length) {
|
||||
RETURN_FAIL("short workbuf: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__error__bad_workbuf_length);
|
||||
}
|
||||
CHECK_STATUS("add_dictionary #5",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_RAW, raw_s,
|
||||
wuffs_base__make_slice_u8(workbuf.ptr, 100)));
|
||||
|
||||
// A transform_io workbuf that is shorter than the dictionaries.
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer have = ((wuffs_base__io_buffer){
|
||||
.data = g_have_slice_u8,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, "test/data/brotli/romeo.txt.q11w22.br"));
|
||||
status = wuffs_brotli__decoder__transform_io(
|
||||
&dec, &have, &src, wuffs_base__make_slice_u8(workbuf.ptr, 99));
|
||||
if (status.repr != wuffs_base__error__bad_workbuf_length) {
|
||||
RETURN_FAIL("transform_io: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__error__bad_workbuf_length);
|
||||
}
|
||||
|
||||
// Dictionaries cannot be added after decoding has started.
|
||||
CHECK_STATUS("initialize", wuffs_brotli__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__DEFAULT_OPTIONS));
|
||||
src.meta.ri = 0;
|
||||
src.meta.wi = 0;
|
||||
src.meta.closed = false;
|
||||
// With no input, decoding has not started (the C code is still in its
|
||||
// BROTLI_STATE_UNINITED state).
|
||||
status = wuffs_brotli__decoder__transform_io(&dec, &have, &src, workbuf);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
RETURN_FAIL("transform_io #0: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__suspension__short_read);
|
||||
}
|
||||
CHECK_STATUS("add_dictionary #6",
|
||||
wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_RAW, raw_s, workbuf));
|
||||
CHECK_STRING(read_file(&src, "test/data/brotli/romeo.txt.q11w22.br"));
|
||||
src.meta.wi = 1;
|
||||
src.meta.closed = false;
|
||||
status = wuffs_brotli__decoder__transform_io(&dec, &have, &src, workbuf);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
RETURN_FAIL("transform_io #1: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__suspension__short_read);
|
||||
}
|
||||
status = wuffs_brotli__decoder__add_dictionary(
|
||||
&dec, WUFFS_BROTLI__DICTIONARY_TYPE_RAW, raw_s, workbuf);
|
||||
if (status.repr != wuffs_base__error__bad_call_sequence) {
|
||||
RETURN_FAIL("after start: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__error__bad_call_sequence);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// ---------------- Large Window and Dictionary Mimic Tests
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
// do_test_mimic_brotli_differential_with_options is like
|
||||
// do_test_mimic_brotli_differential but with the large-window quirk and
|
||||
// attached dictionaries. It sets *skipped (and returns NULL) if libbrotlidec
|
||||
// cannot attach the dictionaries: by default, it does not support serialized
|
||||
// dictionaries.
|
||||
const char* //
|
||||
do_test_mimic_brotli_differential_with_options(const char* name,
|
||||
wuffs_base__io_buffer* src,
|
||||
const char* want_filename,
|
||||
bool want_error,
|
||||
bool large_window,
|
||||
size_t dict_set,
|
||||
bool* skipped) {
|
||||
*skipped = false;
|
||||
wuffs_base__io_buffer have = ((wuffs_base__io_buffer){
|
||||
.data = g_have_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer want = ((wuffs_base__io_buffer){
|
||||
.data = g_want_slice_u8,
|
||||
});
|
||||
wuffs_base__io_buffer src0 = *src;
|
||||
const char* have_status = wuffs_brotli_decode_with_options(
|
||||
&have, &src0, UINT64_MAX, UINT64_MAX, large_window, dict_set);
|
||||
|
||||
size_t num_dicts = 0;
|
||||
uint32_t dict_types[BROTLI_DICT_SPECS_MAX] = {0};
|
||||
wuffs_base__slice_u8 dicts[BROTLI_DICT_SPECS_MAX] = {0};
|
||||
CHECK_STRING(load_brotli_dict_set(dict_set, &num_dicts, dict_types, dicts));
|
||||
wuffs_base__io_buffer src1 = *src;
|
||||
int error_code = 0;
|
||||
const char* want_status = mimic_brotli_decode_with_options(
|
||||
&want, &src1, large_window, num_dicts, dict_types, dicts, &error_code);
|
||||
if (want_status == mimic_brotli_attach_dictionary_failed_message) {
|
||||
*skipped = true;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((have_status == NULL) != (want_status == NULL)) {
|
||||
RETURN_FAIL("%s: have \"%s\", want \"%s\" (error code %d)", name,
|
||||
have_status, want_status, error_code);
|
||||
} else if ((have_status != NULL) &&
|
||||
(brotli_c_error_code(have_status) != error_code)) {
|
||||
RETURN_FAIL("%s: have \"%s\", want error code %d", name, have_status,
|
||||
error_code);
|
||||
} else if ((have_status != NULL) != want_error) {
|
||||
RETURN_FAIL("%s: have \"%s\", want_error %d", name, have_status,
|
||||
(int)want_error);
|
||||
} else if (!want_error && (src0.meta.ri != src1.meta.ri)) {
|
||||
RETURN_FAIL("%s: ri: have %zu, want %zu", name, src0.meta.ri, src1.meta.ri);
|
||||
}
|
||||
if (want_error) {
|
||||
if (have.meta.wi > want.meta.wi) {
|
||||
have.meta.wi = want.meta.wi;
|
||||
} else {
|
||||
want.meta.wi = have.meta.wi;
|
||||
}
|
||||
}
|
||||
const char* status = check_io_buffers_equal("", &have, &want);
|
||||
if (status) {
|
||||
RETURN_FAIL("%s: %s", name, status);
|
||||
}
|
||||
|
||||
// Also check the golden file.
|
||||
if (want_filename) {
|
||||
wuffs_base__io_buffer golden = ((wuffs_base__io_buffer){
|
||||
.data = g_want_slice_u8,
|
||||
});
|
||||
CHECK_STRING(read_file(&golden, want_filename));
|
||||
status = check_io_buffers_equal("", &have, &golden);
|
||||
if (status) {
|
||||
RETURN_FAIL("%s: golden: %s", name, status);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_mimic_brotli_decode_ext_differential() {
|
||||
CHECK_FOCUS(__func__);
|
||||
size_t n = WUFFS_TESTLIB_ARRAY_SIZE(g_brotli_ext_vectors);
|
||||
size_t num_skipped = 0;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
CHECK_STRING(read_file(&src, g_brotli_ext_vectors[i].src_filename));
|
||||
bool skipped = false;
|
||||
CHECK_STRING(do_test_mimic_brotli_differential_with_options(
|
||||
g_brotli_ext_vectors[i].src_filename, &src,
|
||||
g_brotli_ext_vectors[i].want_filename, false,
|
||||
g_brotli_ext_vectors[i].large_window,
|
||||
g_brotli_ext_vectors[i].dict_set, &skipped));
|
||||
num_skipped += skipped ? 1 : 0;
|
||||
}
|
||||
// Only the serialized dictionary files (6 of them) can be skipped.
|
||||
if (num_skipped > 6) {
|
||||
RETURN_FAIL("too many skipped: %zu", num_skipped);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_mimic_brotli_decode_ext_malformed() {
|
||||
CHECK_FOCUS(__func__);
|
||||
size_t n = WUFFS_TESTLIB_ARRAY_SIZE(g_brotli_ext_malformed);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||
.data = g_src_slice_u8,
|
||||
});
|
||||
if (g_brotli_ext_malformed[i].src_filename) {
|
||||
CHECK_STRING(read_file(&src, g_brotli_ext_malformed[i].src_filename));
|
||||
} else {
|
||||
memcpy(src.data.ptr, g_brotli_ext_malformed[i].data,
|
||||
g_brotli_ext_malformed[i].len);
|
||||
src.meta.wi = g_brotli_ext_malformed[i].len;
|
||||
src.meta.closed = true;
|
||||
}
|
||||
char name[64];
|
||||
snprintf(name, sizeof name, "g_brotli_ext_malformed[%zu]", i);
|
||||
bool skipped = false;
|
||||
CHECK_STRING(do_test_mimic_brotli_differential_with_options(
|
||||
name, &src, NULL, true, g_brotli_ext_malformed[i].large_window,
|
||||
g_brotli_ext_malformed[i].dict_set, &skipped));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// mimic_brotli_decode_large_window adapts mimic_brotli_decode_with_options
|
||||
// to do_test_brotli_decode_large_window_far's codec_func type.
|
||||
const char* //
|
||||
mimic_brotli_decode_large_window(wuffs_base__io_buffer* dst,
|
||||
wuffs_base__io_buffer* src,
|
||||
uint64_t wlimit,
|
||||
uint64_t rlimit,
|
||||
bool large_window,
|
||||
size_t dict_set) {
|
||||
if ((wlimit < UINT64_MAX) || (rlimit < UINT64_MAX) ||
|
||||
(dict_set != BROTLI_DICT_SET_NONE)) {
|
||||
return "unsupported option";
|
||||
}
|
||||
int error_code = 0;
|
||||
return mimic_brotli_decode_with_options(dst, src, large_window, 0, NULL,
|
||||
NULL, &error_code);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_mimic_brotli_decode_large_window_far() {
|
||||
CHECK_FOCUS(__func__);
|
||||
return do_test_brotli_decode_large_window_far(
|
||||
mimic_brotli_decode_large_window, UINT64_MAX, UINT64_MAX);
|
||||
}
|
||||
|
||||
#endif // WUFFS_MIMIC
|
||||
|
||||
// ---------------- Brotli Benches
|
||||
|
||||
const char* //
|
||||
@@ -674,6 +1524,14 @@ proc g_tests[] = {
|
||||
test_wuffs_brotli_decode_truncated,
|
||||
test_wuffs_brotli_decode_workbuf_length,
|
||||
|
||||
// Large window and dictionaries.
|
||||
test_wuffs_brotli_add_dictionary,
|
||||
test_wuffs_brotli_decode_ext_all,
|
||||
test_wuffs_brotli_decode_ext_all_with_io_limits,
|
||||
test_wuffs_brotli_decode_ext_malformed,
|
||||
test_wuffs_brotli_decode_large_window_far,
|
||||
test_wuffs_brotli_decode_large_window_quirk,
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
test_mimic_brotli_decode_alice29,
|
||||
@@ -682,6 +1540,11 @@ proc g_tests[] = {
|
||||
test_mimic_brotli_decode_malformed,
|
||||
test_mimic_brotli_decode_romeo,
|
||||
|
||||
// Large window and dictionaries.
|
||||
test_mimic_brotli_decode_ext_differential,
|
||||
test_mimic_brotli_decode_ext_malformed,
|
||||
test_mimic_brotli_decode_large_window_far,
|
||||
|
||||
#endif // WUFFS_MIMIC
|
||||
|
||||
NULL,
|
||||
|
||||
@@ -27,3 +27,57 @@ the other (valid) files and keeping, for each libbrotlidec v1.2.1 error code,
|
||||
the smallest mutated file that produced that error code. The file name
|
||||
mentions that error code, e.g. `invalid.cl-space.br` produces
|
||||
`BROTLI_DECODER_ERROR_FORMAT_CL_SPACE`.
|
||||
|
||||
|
||||
## Large Window and Dictionary Test Data
|
||||
|
||||
These files exercise the `QUIRK_LARGE_WINDOW` quirk and `add_dictionary`. They
|
||||
were generated with brotli v1.2.1: the command line tool where it suffices
|
||||
and otherwise a small C program calling `BrotliEncoderSetParameter` (with
|
||||
`BROTLI_PARAM_LARGE_WINDOW`), `BrotliEncoderPrepareDictionary` and
|
||||
`BrotliEncoderAttachPreparedDictionary`, linked against a libbrotlienc built
|
||||
with `BROTLI_EXPERIMENTAL` (needed for serialized shared dictionaries). Every
|
||||
file's decompressed form was checked with libbrotlidec (also built with
|
||||
`BROTLI_EXPERIMENTAL`).
|
||||
|
||||
- `*.qNlwM.br` are large-window streams (quality N, window bits M), e.g.
|
||||
`brotli -q 11 --large_window=26 -o alice29.txt.q11lw26.br alice29.txt`.
|
||||
- `far17m.q9lw25.br` is a large-window (25 window bits) quality 9 stream whose
|
||||
decompressed form (17 MiB plus 128 KiB, generated by the test program
|
||||
instead of being checked in) is 64 KiB of xorshift32 output, 17 MiB of
|
||||
zeroes and the same 64 KiB again. The second copy refers back more than (1
|
||||
<< 24) bytes. A standard (24 window bits) encoding is twice as large.
|
||||
- `*.raw-romeo.br` use `../romeo.txt` as a raw (LZ77 prefix) dictionary, e.g.
|
||||
`brotli -q 11 -w 22 -D ../romeo.txt -o romeo.txt.q11w22.raw-romeo.br
|
||||
../romeo.txt`.
|
||||
- `*.raw-chunks.br` use several raw dictionaries (compound dictionary chunks):
|
||||
`alice29.txt`'s bytes `[0 .. 20000)`, `[20000 .. 20001)`, `[20001 .. 20001)`
|
||||
(empty) and `[20001 .. 60000)`, or `../romeo.txt`'s bytes `[0 .. 300)`, `[300
|
||||
.. 500)` and `[500 .. 942)`.
|
||||
- `shared-dictionary.*.bin` are serialized shared dictionaries (the format
|
||||
parsed by `BrotliSharedDictionaryAttach` in brotli's
|
||||
`c/common/shared_dictionary.c`), built by a script:
|
||||
- `full` has a 500 byte LZ77 prefix (the start of `../romeo.txt`), two
|
||||
custom word lists (common words from `alice29.txt` and `asyoulik.txt`),
|
||||
two custom transform lists (including `BROTLI_TRANSFORM_SHIFT_FIRST` and
|
||||
`BROTLI_TRANSFORM_SHIFT_ALL` transforms), three (word list, transform
|
||||
list) combinations (the third is the built-in pair) and a context map.
|
||||
- `words` has one custom word list, the built-in transforms and no prefix.
|
||||
- `prefix` has only an LZ77 prefix (the start of `asyoulik.txt`).
|
||||
- `utf8` has a word list of UTF-8 (and invalid UTF-8) words and shift
|
||||
transforms with various parameters.
|
||||
- `shared-dictionary.text` is made of `shared-dictionary.full.bin` words,
|
||||
transformed by its transforms. `*.sd-full.br` (and `*.sd-words.br`) were
|
||||
compressed with `shared-dictionary.full.bin` (and `.words.bin`) attached.
|
||||
`asyoulik.txt.q11w18.sd-prefix-raw.br` was compressed with
|
||||
`shared-dictionary.prefix.bin` and then `../romeo.txt`'s first 300 bytes
|
||||
(raw) attached.
|
||||
- `romeo-mutated.sd-utf8.br` is a mutated `romeo.txt.q5w10.br` that decodes
|
||||
(to `romeo-mutated.sd-utf8.txt`) without error when
|
||||
`shared-dictionary.utf8.bin` is attached, and whose dictionary references
|
||||
apply shift transforms to 1, 2, 3 and 4 byte UTF-8 sequences.
|
||||
- `invalid.lw-*.br`, `invalid.raw-*.br` and `invalid.sd-*.br` are malformed.
|
||||
They were found by mutating the files above, like the other `invalid.*.br`
|
||||
files, with the large-window quirk set (`lw`), or the raw (`raw`, the
|
||||
`romeo.txt` chunks) or serialized (`sd`, `shared-dictionary.full.bin`)
|
||||
dictionaries attached.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
âvŒ¸)MëÍ{> ài©Ã`n␍gήy¼€ÈfÏò0¬aQIÿËS)”߇„
|
||||
@@ -0,0 +1 @@
|
||||
âvŒ¸)MëÍ{> ài©Ã`n␍gήy¼€ÈfÏò‰Aióûì×baQIÿË])”Þ‡„rÁ|<E
|
||||
@@ -0,0 +1 @@
|
||||
âvŒ¸)MëÍ{> ài©Ã`n␍gήy¼€ÈfÏò0�¯>n€‰Áióû
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
Romeo and Juliet
|
||||
Excerpt Ÿ˜€ Act 2, Scene 2
|
||||
|
||||
JULIET
|
||||
O €xy,ULIET
|
||||
! linksfore art thouULIET
|
||||
?
|
||||
Deny thy signedo andtake p thy name;
|
||||
Or, Contaou wilt not, be but sworn my `₫é,
|
||||
And I'll the worlde bua Capulet.
|
||||
|
||||
ROMEO
|
||||
[Aside] Sif(! I usin more, or sif(! I Perso athouis?JULIET
|
||||
O 'Tisut swy name;
|
||||
Italiany `âenemy;
|
||||
Tu wit thouyhold,aou wghot, a Montague.
|
||||
What's Montague? remaininr hand,ninr foot,
|
||||
Nnr arm,ninr face,ninr They were part
|
||||
Be woring to a man. Obe busomey were me;
|
||||
!
|
||||
What's in a me;
|
||||
? Italilinks we cf(! a four
|
||||
By They were me;
|
||||
situatsme(! as onkey;
|
||||
SoIET
|
||||
?
|
||||
situa, were heot, ET
|
||||
?
|
||||
cf(!'d,
|
||||
Retaoutbrat dsin perf
|
||||
|
||||
Whililinks he owes
|
||||
Wiou wttbrat نك.€xy,ULd
|
||||
|
||||
Many name;©,
|
||||
Andf; widthe me;
|
||||
linksmainie par =falsee
|
||||
Takeo ll muyholt.
|
||||
|
||||
ROMEOI takeolseeo athoy das:
|
||||
Co ll e but `â‚«Ão andd I'lbe new missized;
|
||||
Hencsforth I sound investor€xy.s?JULIET
|
||||
!
|
||||
Wh a m art thouU? Itahide be🗿èé'd in €¿øÿ;
|
||||
Sostumblest o my `counsel?
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
causeHAVE
|
||||
uncoTURTLE, uhoughtfullycharles -audrey-fatherdaughter Somethingsheph HASTILY, phebeSHOULDSHEPHERDInterruptedlike fortune things. hoingextraordinary. erhaps said aterpillar Wonderrabbi well everything's Everything charlesthere corin anything's -silvius-WILLIAMDisappointment better RepliedDAUGHTER will thoughtfully QuestionsilviusAnythingturtle
|
||||
looking mucquite
|
||||
charlesthe disappointment INTERRUPTED, that FORTUNEuncomfortable, daughter Childrenph the uncomfortable right
|
||||
-love-bettermistresstraordinaryreplied's -brother-derstand there t yourorlando-should-senior bnmudqr`shnm ph this -should-
|
||||
haveSENIOR the children extraordinary. wouldcon Dormousenversation-audrey- h silvius knnjdc sen the executioner disappointmentcorin oli y okingexecutioner children g`ssdq phebe -daughter-w adventures's -jaques-frightened's opportunity's the interrupted w mistress little. thoughtfully
|
||||
anything -should- THATContemptuouslyeconthings. contemptuouslrself t corin CORIN-mistress-will noonqstmhsx beginning Extraordinaryextraordinary conversatioOpportunity -father-getting. enter conversatioPRITHEEcontesheph mockanother. HAVE ␍inute l thoughtfully's withperhaps-orlando-seemed
|
||||
Wonderforestthe frightened which willremember. have co THAT, daughter -william-Disappointmenttuchdaughter -audrey-LOOKED, the turtle orlandofather sh Interrupted beginning could's rosalindhave xtraordinary Looking jaquesnversationuncomfortablable disappointment phebe -orlando-dormouse mistresshoughtfully THERE nterrupted op thoughtfullextraordinary, -there-contemptuouslySHALLshall jaq creatures -senior-phebe t CREATURES, sheph ed Thoughtfullythe nothing LookingINTO, everything con Alice-prithee-charlesursewhichlooked rather uWhile White DAUGHTERDisappointment love your Opportunitydifferent. rosalind -would-EVERYTHING, -father- father -oliver-ANOTHER, en enough celia-forest- the thought ROSALINDseniorFORTUNEFATHERdhildren uncomfortable's ce -that-love mistr ONLY, should phebe-brother-l eyeifferent orlandoInterrupted-senior-pheberueen ExtraordinaryBEFORE, shepherdCHARLESbetter should brotherfortune t -orlando-audrey mistr daugh will sen disappointmentextraordinarythe things withieardokd`rd HAVE disappointment, sh ph noonqstmhsx very-oliver-ce daughterbdqs`hmkx w BROTHERTHISl ORLANDO the other oli will nversationconversatiowhich ously mistr ce rosalind because's thoughtfull disappointment -this-AUDREYdisappointment mistr the understand frightened
|
||||
y gdqrdke Creatures onversation AUDREY conversation went's extraordinary's WITHextrautifulanotheren interrupted -rosalind-orlando-orlando-Extraordinaryeirrosalind suddenly, -charles-charlesvoice
|
||||
bnythingonversation t CHARLES-another--silvius-contemptuously
|
||||
UNCOMFORTABLE, caterpillashepherd uncomfortable -father-father would xtraordinary SHOULDvgdm JAQUES-there--shepherd-creatures. Little ROSALIND-will- DAUGHTER-another-daugh rosal without's nary curious. ckaud would MISTRESScharles thou shallCertainly-orlando-extraordinary
|
||||
seniordaughter thoughtfullshepherdWITHonly. -senior-Continued this EXTRAORDINARY, fortune
|
||||
THAT-audrey-ufat more -charles-things. BROTHERFRIGHTENED, sghmf THERElovethe certainly aud this -will- brotherthe getting
|
||||
with's shepherdoli THIS -another-the seemed xiouslyoliver-shepherd-caterpillar
|
||||
which wh daugh mistress Opportunity getting -rosalind-dmntfg ANOTHERthoughtfully SHOULDprithee oliverbet eisappointment thou certainly With methingsho replied.
|
||||
this shepherdcharlesrosalindbetter en sheph -which--orlando--celia-rightened ke fat the beautiful will HAVE-have--love-WOULD thisfor MUCH, well's thouprit contemptuously -celia-vncomfortablelly-oliver- finishelovethe conversation thoughtfullyOLIVER-enter-ar LOOKED, onversation -love-phebe Conversationuncomfortable, extraordinary
|
||||
mistressbefore. onder adventures have-thou-SILVIUS-silvius-conversation's t more's daughtersho -shepherd-white, tmcdqrs`mc rosal thingtalking, alice. ormouse Thinking remember Round Perhapsthere for MISTRESS beginning. your-this-anxiouslmistress UNCOMFORTABLE, Uncomfortable -phebe-wh etting CONTEMPTUOUSLY, silvius isappointment thoadventures's extraordinar caterpillar mistressthe interrupted
|
||||
rosal seniorreat SILVIUSnough daughter able contecorin mistress-charles-going
|
||||
Contemptuously brot nderstand HAVEAUDREYyour celia -should- willCONTEMPTUOUSLY, -audrey-sho thiseginning char willtmentmarch's sheph fverythingconversation. the mouse -audrey-there silv othing willonly. the understand LOVEsheph daugh BeforekingecutionerConversation AUDREYPRITHEE-which-the should -jaques- should. withginishedbet tmbnlenqs`akd like. beginning -should-rosalind NOTHING, bnmsdlostntrkx conversation
|
||||
large. something-rosalind--mistress--another--there--william-Contemptuously That executioner's thoughtfully, thinking However fat uhen shouldperhapDAUGHTERopSHOULD disappointment the extraordinary thereqerhapscorinThoughtfullywould contemptuously orlando terpillarmistress about -rosalind--fortune-abbit thereanot interrupted-your-this such -daughter-the queen ph Conversationsgntfgsetkkx orlando silvius -father- Anything extraordinary Before Begant there uhemthe could THATperhaps ruestionsgntfgsetkkx aud rosal getting
|
||||
mistr mistr extraordinary
|
||||
ierecharles thinkingYOURsilv t interrupted
|
||||
which audrey daugh thothis Disappointment extraordinary, your voice edEXTRAORDINARY, comfortable conversation, -prithee-h HEARD, which everythin xtraordinary understand children white. -father-WhatThoughtfully co silviusmust
|
||||
ightenedrosal would somethin -father--shall--would-extraordinary's SHEPHERDextrjaq there InterruptedInterrupted THATsen SENIORyour conversation
|
||||
celia -celia--better--love- SHOULDphebe OLIVERmistr remember Uncomfortable -jaques-rosal aud conversation THOUGHTFULLY, the before WOULD-forest-ere -mistress-williambrother -will--that-THAT-prithee-for fatherWILL rosalindxecutioner understand's much, brother come -mistress-dwdbtshnmdq SILVIUSaudrey nomentonversation -brother- ROSALINDyourppportunitywithshepherden corin jaqueswiththis EVERYTHING, the were -fortune- vncomfortablemistress celiarosalindthosghmfr remember WILLIAMaud Disappointmentcorin fxecutionerntemptuously daughterell Extraordinaryad`tshetk thouopportunity venturesthe come -shepherd-uchess caterpillar. mistressSHOULD -rosalind-celia ROSALINDntemptuouslyEXTRAORDINARY, know fortune the again THEREthere disappointmenthoughtfullygryphon. SHOULDmistr CORIN-shall-thinkingEVERYTHING, OLIVERSomething DAUGHTERyourOLIVERshepherd thoughtfully. -orlando-FORESTBROTHERrselffortune -which-y lovephebe-celia-dontemptuouslyund Executionerlike Looking-prithee-WOULDlove-forest- -thou--father-ConversationrosalindCreatures fortune uncomfortable phebeinterrupted WILLIAMSHEPHERDDisappointment wh xecutioner should rosalind jaquesDAUGHTERremembe SILVIUSfverythingaterpillar HAVEthe remember Executionerw theirwent charlesbetterhead DAUGHTERcontemptuousl FORTUNEbrot CATERPILLAR, eard gryphon
|
||||
WOULDshepherd enterloveuncomfortable, Understand-oliver-ENTERthe quite -rosalind-fortunedaugh bettercontemptuouslsomCELIA the voice betterthey, -should-audreywould co understandTHOUnversation
|
||||
lice -enter- Caterpillar THINKING, shepherd Disappointmentoliver-mistress-senior co WILLIAMBROTHERrosal jaquesORLANDOuncomfortable
|
||||
executioney your, FORTUNE-there-mistr mistr sheph with
|
||||
en mistress the without Contemptuouslyphebe -daughter-eautiful nterrupted orlandoopportunity's contemptuouslybeginning
|
||||
brot Going anot usecurious, w shepherd dormouse
|
||||
uncomfortable Beautifulgryphon's MISTRESSdaughter Everything erythingEXTRAORDINARY, Thoughtfully -charles-extraordinary, ion while
|
||||
forest daugh SILVIUSyour Caterpillar en suddenly vnmcdq PHEBE-shepherd-shoulddventures fortune understand
|
||||
EXTRAORDINARY, Adventuresdontemptuouslyable hastily, thoughtfully. Frightened which h mistr mistress -shall-enterthe understand -better-uestion Contemptuously ph willinterrupted Gettingknow, shall into. hmsn Mock Continued seemed have extraordinary's march, celiaWHICHb`sdqohkk`q SILVIUSunderstanDAUGHTER the caterpillar dudqxsghmf better -another-THERE brother understand. -there-phebe ableYOUR-celia- t FORTUNEAUDREY-shepherd-enter extraordinar mistress WHICHchildren's disappointment's BROTHERddenlyGetting tmbnlenqs`akd DAUGHTERTHERE-silvius-vncomfortablerosal remember, BETTERWITHdaugh Creaturesdwithout, contemptuously's PHEBEdaughterWILLthincelia opportunit ightenedextraordinary -oliver-Extraordinarycorinicethoughtfully
|
||||
Thoughtfullythis-that- LookedConversation vhsg ␍uch large littlorla -corin-mistress there-this- conversation. extraordinary's thoughtfullExtraordinary must, portunityDAUGHTER conversation's william Everything-daughter-frightened's sho Finished another, mistr CONTEMPTUOUSLY, -love-the creatures sheph the suddenly orla seemed. vncomfortablefor ith w senior rabbitmistress ANOTHERtho-daughter--shepherd-remember's fxtraordinary-shall-opportunity-audrey-our Thoughtorlando -shall--shall- BeginningInterrupted FINISHED, tmentorlando -charles-uhemwhat's -orlando-contemptuously's tuddenlyCOURSE, CHILDREN, phebe -celia- something betterunderstandCHARLES thoughtfully, different's white -there-Frightened y silvius orla jnterruptedFORTUNEph -thou-hoing WILLIAMturtle's rabbithe beautiful Thoughtfully disappointment. Beginning VERY, seemed said ph char HOWEVER, rosalind BeautifulCURIOUS, RABBIT, extraordinary
|
||||
Anything SILVIUSextraordinar thoughtfully. -better-your shall dontemptuouslyfort SHEPHERD daterpillarsh daughter oli disappointmententer Children -jaques-haves`kjhmf orlando SENIORwhich daughter down Uncomfortable rosalindrosal co mistr might. -should-phebe wo loveq`aahs opportunity. Uncomfortable oprosalindooking -which-thou the thinking marchbefore, -with--there-bet t oliverfortune-celia-jaquesprithee th -your- -fortune--senior-disappointment lly-with-CONTEMPTUOUSLY, come. charles WHEN, sh prit onversation the again -shepherd-jaques silvius RoundBROTHERbrot enter corin orlandosabbitWOULD-this-getting. CONVERSATION, which Questioncorin thatORLANDOthe such hings thoughtfully en aud Themmistr rious Contemptuously daughterround, the caterpillar Disappointment art shall INTERRUPTED, goingSHEPHERDsuddenly. -better- THISWILL-orlando-THATAnxiously contemptuously. FORTUNEagain
|
||||
-have-HAVETHOUGHTFULLY, nother Uncomfortablesho -forest-corin DAUGHTERHavefrightened everything
|
||||
would onversation sh -your--with- shepherd ChildrenorlandoCHARLESbrother Went something -which-rosalind-silvius-anotherdaughter CELIAHerself extraordinary
|
||||
Enough Extraordinary-prithee-wo corin HAVE-prithee-daughterhoweverce adventures w must phebe extraordinary's SHOULD-brother-traordinaryrosalind will ouldrosalind the something -that--prithee- king
|
||||
father the uncomfortable FOREST First brotherquestion
|
||||
WENT, THEREmistr -prithee- Uncomfortablefort with question outwould WOULDsheph BETTERright's narybrother william tting-will-WHICHSILVIUS-another-onder bnmudqr`shnm JAQUES-better-they's THISphebeWOULD -mistress-Anxiously thouContemptuously Withittle sheph Caterpillardifferent.
|
||||
THISThoughtfullybrother -charles- sen betterTHISwould -senior-that that bnmudqr`shnm CURIOUS,
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user