Files
Brotli 6a14c07982 Preserve shared dictionary state on serialized parse failure.
When attaching a serialized shared dictionary (`BROTLI_SHARED_DICTIONARY_SERIALIZED`), `ParseDictionary` previously mutated `BrotliSharedDictionary` fields in-place before validating all entries and did not roll back on error. If parsing failed partway through (such as when a `context_map` entry exceeded `num_dictionaries` or when input ended before all `(words_index, transforms_index)` pairs were read), `BrotliSharedDictionaryAttach` returned `BROTLI_FALSE` while leaving the dictionary in a partially populated state. Subsequent decompression calls that proceeded after a failed attachment could then index out of bounds of `words` and `transforms` or dereference null dictionary pointers. In addition, attaching a prefix-only serialized dictionary (`num_word_lists == 0` and `num_transform_lists == 0`) onto a `BrotliSharedDictionary` that already had custom word or transform lists previously overwrote those custom tables with the built-in static dictionary.

Validate `num_word_lists`, `num_transform_lists`, `num_dictionaries`, `context_based`, and `context_map` entries using local variables before committing them to `BrotliSharedDictionary` (preserving existing custom word and transform lists when appending a prefix-only serialized dictionary), and restore the prior dictionary state (freeing any newly allocated word, transform, or prefix-suffix tables) in `DecodeSharedDictionary` whenever `ParseDictionary` fails.

PiperOrigin-RevId: 1021295358
2026-11-13 13:42:16 -08:00
..
2025-08-05 02:49:40 -07:00
2020-05-15 11:06:21 +02:00
2025-08-05 02:49:40 -07:00
2025-08-05 02:49:40 -07:00
2025-08-05 02:49:40 -07:00
2025-09-01 04:46:12 -07:00
2025-08-05 02:49:40 -07:00
2025-10-06 03:48:49 -07:00