126fa459cSmrg<p align="center"><img src="https://brotli.org/brotli.svg" alt="Brotli" width="64"></p> 226fa459cSmrg 326fa459cSmrg# SECURITY NOTE 426fa459cSmrg 526fa459cSmrgPlease consider updating brotli to version 1.0.9 (latest). 626fa459cSmrg 726fa459cSmrgVersion 1.0.9 contains a fix to "integer overflow" problem. This happens when "one-shot" decoding API is used (or input chunk for streaming API is not limited), input size (chunk size) is larger than 2GiB, and input contains uncompressed blocks. After the overflow happens, `memcpy` is invoked with a gigantic `num` value, that will likely cause the crash. 826fa459cSmrg 926fa459cSmrg### Introduction 1026fa459cSmrg 1126fa459cSmrgBrotli is a generic-purpose lossless compression algorithm that compresses data 1226fa459cSmrgusing a combination of a modern variant of the LZ77 algorithm, Huffman coding 1326fa459cSmrgand 2nd order context modeling, with a compression ratio comparable to the best 1426fa459cSmrgcurrently available general-purpose compression methods. It is similar in speed 1526fa459cSmrgwith deflate but offers more dense compression. 1626fa459cSmrg 1726fa459cSmrgThe specification of the Brotli Compressed Data Format is defined in [RFC 7932](https://tools.ietf.org/html/rfc7932). 1826fa459cSmrg 1926fa459cSmrgBrotli is open-sourced under the MIT License, see the LICENSE file. 2026fa459cSmrg 2126fa459cSmrgBrotli mailing list: 2226fa459cSmrghttps://groups.google.com/forum/#!forum/brotli 2326fa459cSmrg 2426fa459cSmrg[](https://travis-ci.org/google/brotli) 2526fa459cSmrg[](https://ci.appveyor.com/project/szabadka/brotli) 2626fa459cSmrg[](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#brotli) 2726fa459cSmrg 2826fa459cSmrg### Build instructions 2926fa459cSmrg 3026fa459cSmrg#### Vcpkg 3126fa459cSmrg 3226fa459cSmrgYou can download and install brotli using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: 3326fa459cSmrg 3426fa459cSmrg git clone https://github.com/Microsoft/vcpkg.git 3526fa459cSmrg cd vcpkg 3626fa459cSmrg ./bootstrap-vcpkg.sh 3726fa459cSmrg ./vcpkg integrate install 3826fa459cSmrg vcpkg install brotli 3926fa459cSmrg 4026fa459cSmrgThe brotli port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. 4126fa459cSmrg 4226fa459cSmrg#### Autotools-style CMake 4326fa459cSmrg 4426fa459cSmrg[configure-cmake](https://github.com/nemequ/configure-cmake) is an 4526fa459cSmrgautotools-style configure script for CMake-based projects (not supported on Windows). 4626fa459cSmrg 4726fa459cSmrgThe basic commands to build, test and install brotli are: 4826fa459cSmrg 4926fa459cSmrg $ mkdir out && cd out 5026fa459cSmrg $ ../configure-cmake 5126fa459cSmrg $ make 5226fa459cSmrg $ make test 5326fa459cSmrg $ make install 5426fa459cSmrg 5526fa459cSmrgBy default, debug binaries are built. To generate "release" `Makefile` specify `--disable-debug` option to `configure-cmake`. 5626fa459cSmrg 5726fa459cSmrg#### Bazel 5826fa459cSmrg 5926fa459cSmrgSee [Bazel](http://www.bazel.build/) 6026fa459cSmrg 6126fa459cSmrg#### CMake 6226fa459cSmrg 6326fa459cSmrgThe basic commands to build and install brotli are: 6426fa459cSmrg 6526fa459cSmrg $ mkdir out && cd out 6626fa459cSmrg $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed .. 6726fa459cSmrg $ cmake --build . --config Release --target install 6826fa459cSmrg 6926fa459cSmrgYou can use other [CMake](https://cmake.org/) configuration. 7026fa459cSmrg 7126fa459cSmrg#### Premake5 7226fa459cSmrg 7326fa459cSmrgSee [Premake5](https://premake.github.io/) 7426fa459cSmrg 7526fa459cSmrg#### Python 7626fa459cSmrg 7726fa459cSmrgTo install the latest release of the Python module, run the following: 7826fa459cSmrg 7926fa459cSmrg $ pip install brotli 8026fa459cSmrg 8126fa459cSmrgTo install the tip-of-the-tree version, run: 8226fa459cSmrg 8326fa459cSmrg $ pip install --upgrade git+https://github.com/google/brotli 8426fa459cSmrg 8526fa459cSmrgSee the [Python readme](python/README.md) for more details on installing 8626fa459cSmrgfrom source, development, and testing. 8726fa459cSmrg 8826fa459cSmrg### Benchmarks 8926fa459cSmrg* [Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/) / [Unstable Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/unstable/) 9026fa459cSmrg* [Large Text Compression Benchmark](http://mattmahoney.net/dc/text.html) 9126fa459cSmrg* [Lzturbo Benchmark](https://sites.google.com/site/powturbo/home/benchmark) 9226fa459cSmrg 9326fa459cSmrg### Related projects 9426fa459cSmrg> **Disclaimer:** Brotli authors take no responsibility for the third party projects mentioned in this section. 9526fa459cSmrg 9626fa459cSmrgIndependent [decoder](https://github.com/madler/brotli) implementation by Mark Adler, based entirely on format specification. 9726fa459cSmrg 9826fa459cSmrgJavaScript port of brotli [decoder](https://github.com/devongovett/brotli.js). Could be used directly via `npm install brotli` 9926fa459cSmrg 10026fa459cSmrgHand ported [decoder / encoder](https://github.com/dominikhlbg/BrotliHaxe) in haxe by Dominik Homberger. Output source code: JavaScript, PHP, Python, Java and C# 10126fa459cSmrg 10226fa459cSmrg7Zip [plugin](https://github.com/mcmilk/7-Zip-Zstd) 10326fa459cSmrg 10426fa459cSmrgDart [native bindings](https://github.com/thosakwe/brotli) 105