There is no CRC in the format and there is no way to detect corruption #391

Open
opened 2026-01-29 20:43:11 +00:00 by claunia · 0 comments
Owner

Originally created by @eshkinkot on GitHub (Aug 30, 2021).

git clone https://github.com/google/brotli.git
cd brotli/
make

echo 'this is test file for check compression checksums' > file
bin/brotli file
cp file.br file-corrupt.br
echo -ne '\xA6' | dd bs=1 conv=notrunc seek=$((0x18)) of=file-corrupt.br
$ hd file.br; hd file-corrupt.br
00000000  a1 88 01 00 2f b0 01 e7  0b ed 32 4e 7d 0f 52 88  |..../.....2N}.R.|
00000010  2a c0 68 10 2a 86 63 e7  b6 30 5f 4b 50 3e b3 40  |*.h.*.c..0_KP>.@|
00000020  bc 08                                             |..|
00000022
00000000  a1 88 01 00 2f b0 01 e7  0b ed 32 4e 7d 0f 52 88  |..../.....2N}.R.|
00000010  2a c0 68 10 2a 86 63 e7  a6 30 5f 4b 50 3e b3 40  |*.h.*.c..0_KP>.@|
00000020  bc 08                                             |..|
00000022
$ bin/brotli -v -t file-corrupt.br; echo $?
Decompressed [file-corrupt.br]: 34 B -> 50 B in 0.00 sec
0
$ bin/brotli -v -d file-corrupt.br; echo $?
Decompressed [file-corrupt.br]: 34 B -> 50 B in 0.00 sec
0
$ hd file; hd file-corrupt
00000000  74 68 69 73 20 69 73 20  74 65 73 74 20 66 69 6c  |this is test fil|
00000010  65 20 66 6f 72 20 63 68  65 63 6b 20 63 6f 6d 70  |e for check comp|
00000020  72 65 73 73 69 6f 6e 20  63 68 65 63 6b 73 75 6d  |ression checksum|
00000030  73 0a                                             |s.|
00000032
00000000  74 68 69 73 20 69 73 20  0a 65 73 74 20 66 69 6c  |this is .est fil|
00000010  65 20 66 6f 72 20 63 68  65 63 6b 20 63 6f 6d 70  |e for check comp|
00000020  72 65 73 73 69 6f 6e 20  63 68 65 63 6b 73 75 6d  |ression checksum|
00000030  73 0a                                             |s.|
00000032

vbindiff file file-corrupt

Originally created by @eshkinkot on GitHub (Aug 30, 2021). ``` git clone https://github.com/google/brotli.git cd brotli/ make echo 'this is test file for check compression checksums' > file bin/brotli file cp file.br file-corrupt.br echo -ne '\xA6' | dd bs=1 conv=notrunc seek=$((0x18)) of=file-corrupt.br ``` ``` $ hd file.br; hd file-corrupt.br 00000000 a1 88 01 00 2f b0 01 e7 0b ed 32 4e 7d 0f 52 88 |..../.....2N}.R.| 00000010 2a c0 68 10 2a 86 63 e7 b6 30 5f 4b 50 3e b3 40 |*.h.*.c..0_KP>.@| 00000020 bc 08 |..| 00000022 00000000 a1 88 01 00 2f b0 01 e7 0b ed 32 4e 7d 0f 52 88 |..../.....2N}.R.| 00000010 2a c0 68 10 2a 86 63 e7 a6 30 5f 4b 50 3e b3 40 |*.h.*.c..0_KP>.@| 00000020 bc 08 |..| 00000022 $ bin/brotli -v -t file-corrupt.br; echo $? Decompressed [file-corrupt.br]: 34 B -> 50 B in 0.00 sec 0 $ bin/brotli -v -d file-corrupt.br; echo $? Decompressed [file-corrupt.br]: 34 B -> 50 B in 0.00 sec 0 $ hd file; hd file-corrupt 00000000 74 68 69 73 20 69 73 20 74 65 73 74 20 66 69 6c |this is test fil| 00000010 65 20 66 6f 72 20 63 68 65 63 6b 20 63 6f 6d 70 |e for check comp| 00000020 72 65 73 73 69 6f 6e 20 63 68 65 63 6b 73 75 6d |ression checksum| 00000030 73 0a |s.| 00000032 00000000 74 68 69 73 20 69 73 20 0a 65 73 74 20 66 69 6c |this is .est fil| 00000010 65 20 66 6f 72 20 63 68 65 63 6b 20 63 6f 6d 70 |e for check comp| 00000020 72 65 73 73 69 6f 6e 20 63 68 65 63 6b 73 75 6d |ression checksum| 00000030 73 0a |s.| 00000032 ``` ![vbindiff file file-corrupt](https://user-images.githubusercontent.com/69589/131365671-1abb7e40-53da-442a-b4c2-50902cc8da6c.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#391