mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
JavaScript throws Corrupted reserved bit #465
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ijjy on GitHub (Jul 4, 2023).
I'm making my own web application which based on html + js + wasm (created by emscripten). I want to compress my wasm to br and decompress br before loading wasm. I use Mac Terminal to compress wasm.
brotli -o *.wasm.br *wasmWhile I use decode.js to decode content of br file, I get the error 'Corrupted reserved bit'. (Actually, I tried both decode.js and decode.min.js) I'm sure the content of the Int8ArrayBuffer I pass to BrotliDecode is correct (i.e. matches the content of br file).
If I use
brotli -d -o *.wasm *.wasm.brto decode br file, the output matches wasm file that I compressed.What should I do?
@eustas commented on GitHub (Jul 4, 2023):
Hi. Could you attach compressed file, so that I could debug the decoder.
@ijjy commented on GitHub (Jul 4, 2023):
MyCppStatic.wasm.br.zip
Here is it. Unzip before you debug.
@eustas commented on GitHub (Jul 4, 2023):
Thanks, will take a look soon.
@eustas commented on GitHub (Jul 4, 2023):
Likely compressed data is corrupted somewhere before decoding.
Attaching demo that decoding works OK:
data.jsis your.brfile encoded as base64,index.htmlis "main" anddecode.jsis decoder from trunk.test.zip
@ijjy commented on GitHub (Jul 5, 2023):
Thank you! It works!
Still, I have 2 questions:
@eustas commented on GitHub (Jul 5, 2023):
As I've said, data is corrupted somewhere before decoding.
brfile you've shared is fine.To convert it to base64 I run
base64 -w 0 -i input-file.br > output-file.jsand then frame output with variable declaration. But, of course, it makes file 1.33x larger.