Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brotli support? #11

Open
ericlaw1979 opened this issue Feb 11, 2022 · 2 comments
Open

Brotli support? #11

ericlaw1979 opened this issue Feb 11, 2022 · 2 comments

Comments

@ericlaw1979
Copy link

A while back, Chromium started using Brotli compression on textual resources. It doesn't look like the unpacker handles that?

If I strip 8 bytes off the front of the file extracted from unpack.bat, I can then use brotli.exe to uncompress the resource.

@myfreeer
Copy link
Owner

myfreeer commented Feb 12, 2022

References:
https://github.com/chromium/chromium/blob/c4d3c31083a2e1481253ff2d24298a1dfe19c754/tools/grit/grit/node/base.py#L657
https://github.com/chromium/chromium/blob/c4d3c31083a2e1481253ff2d24298a1dfe19c754/ui/base/resource/resource_bundle.h#L58
https://datatracker.ietf.org/doc/html/rfc7932#page-31

Format of brotli compressed resource:
2 bytes header: {0x1e, 0x9b}
6 bytes decompressed size: truncated to 6 bytes, little-endian.
compressed brotli stream

For unpacking we can detect the header bytes and truncate header and decompressed size from output, but for packing we have to parse the brotli stream, iterating all meta blocks, and restore the decompressed size, which takes time to implement.

Update: seems impossible to get uncompressed size without decompression google/brotli#861

Maybe we can make a chromium-specific brotli compression tool for this chromium-specific brotli compression format.

@myfreeer
Copy link
Owner

See experimental work at https://github.com/myfreeer/chrome-pak-customizer/tree/3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants