In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
GZIP structure diagram:
The key to repairing a corrupted gzip file is to find the starting point of the next normal package. According to the information in the structure diagram, we can know whether the start structure of each package reaches the tail mark, the type of Huffman tree used, and the number of tree elements of the three Huffman trees. If there is a bad sector in the middle of a gzip file, to find a normal starting point after the bad sector, just move to the right by bit, all the way to a bit that can be decompressed normally, and you may find the correct start of the package. According to the 32KB size of the compression job window of the gzip file, this traversal can be found no more than 64KB. Fast loops in memory can be found quickly, but there needs to be a clear way to judge the error.
The first thing that can be made clear is the end mark, which should be 0 (we are looking back from the point of damage). The type of Huffman tree should be dynamic 0x02, the number of elements of cl1 should be between 257 and 286 (including boundary), the number of elements of cl2 should be less than or equal to 30 CCL, and the number of elements of Huffman should be 1-15 (including boundary).
In fact, we can also refer to whether the unlocked Huffman tree is abnormal, or find the last value with a value of 256 through the principle of regularity, but these algorithms should be troublesome. It is enough to have the above algorithm to check several compression blocks continuously.
The specific method is to modify the source code of gzip and traverse it. Due to time constraints, did not make a general project, only quickly modified part of the code. The approximate modification points are:
First, find the damage point:
In unzip.c
Error ("invalid compressed data--format violated")
Before this line, you can get the current decoding byte position.
Second, traverse to find the damage point:
1. In the inflate.c file, change
If (nl > 286 | | nd > 30)
# endif
Return 1
Are:
If (nl > 286 | | nd > 30 | | nl
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.