mirror of
https://github.com/google/brotli.git
synced 2026-09-22 14:45:51 +00:00
There is no CRC in the format and there is no way to detect corruption #394
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 @eshkinkot on GitHub (Aug 30, 2021).
@eustas commented on GitHub (Aug 31, 2021):
That is correct. Brotli itself is a stream format. It lacks features like CRC, multiple entries, uncompressed size info, rewind, etc.
Currently one could add custom "framing" to address that. Later Brotli Framing could be an out-of-the-box solution
@eustas commented on GitHub (Aug 31, 2021):
Alternatively one could also use Rigeli as framing format.
@eshkinkot commented on GitHub (Sep 2, 2021):
I think that the main problem here is that this code is already used in various projects without any changes. For example, in wal-g, and archives created by wal-g with brotli compression cannot be checked for damage now.
Perhaps it is worth mentioning explicitly in the documentation/README about this feature that this is more of an example code and for use in production it is better to wrap it in some kind of container with CRC.
@eustas commented on GitHub (Sep 8, 2021):
Sure, will mention in README.
However, the scope of possible damage is very small: only uncompressible data is dumped as is. For entropy coded data (compressible) the probability that corrupted data is not noticed is very small. I could prepare a script to calculate it.
@eustas commented on GitHub (Jan 3, 2023):
Resolved in a8f581
@Artoria2e5 commented on GitHub (Apr 13, 2023):
Brotli running without framing is hurting its chances at replacing gzip in the tar.gz usecase. At least this is the story on the bsdtar (libarchive) side https://github.com/libarchive/libarchive/issues/1238#issuecomment-529746683: it does a very Unix approach to format detection using no file name but just contents, but brotli has no magic number for it to work with. The attempted gnu tar patch also seems to have hit that, but gnu tar looks at names so that's not the main issue.
The framing thing seems to be advancing? Let's wait then. Although I would love to see it available for toying in the command-line thing...
Oops, should've posted to the other issue about containers.