⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defer.in

📁 完整的解压zip文件的源码。包含密码功能
💻 IN
字号:
[Regarding an optimization to the bounds-checking code in the core NEXTBYTE macro, which code is absolutely vital to the proper processing of corrupt zipfiles (lack of checking can result in an infinite loop) but which also slows processing.]The key to the solution is a pair of small functions calleddefer_leftover_input() and undefer_input().  The idea is, wheneveryou are going to be processing input using NEXTBYTE, you calldefer_leftover_input(), and whenever you are going to process input byany other means, such as readbuf(), ZLSEEK, or directly reading stuffinto G.inbuf, you call undefer_input().  What defer_leftover_input()does is adjust G.incnt so that any data beyond the current end of fileis not visible.  undefer_input() restores it to visibility.  So whenyou're calling NEXTBYTE (or NEEDBITS or READBITS), an end-of-datacondition only occurs at the same time as an end-of-buffer condition,and can be handled inside readbyte() instead of needing a check in theNEXTBYTE macro.  Note: none of this applies to fUnZip.In order for this to work, certain conditions have to be met:  1) NEXTBYTE input must not be mixed with other forms of input involving     G.inptr and G.incnt.  They must be separated by defer/undefer.       I believe this condition is fully met by simply bracketing the central  part of extract_or_test_member with defer/undefer, around the part  where the actual decompression is done, and another defer/undefer pair  in decrypt() around the reading of the RAND_HEADER_LEN password bytes.  When USE_ZLIB is defined, I think that calls of fillinbuf() must be  bracketed by defer/undefer.  2) G.csize must not be assumed to contain the number of bytes left to     process, when decompressing with NEXTBYTE.  Instead, it contains     the number of bytes left after the current buffer is exausted.  To     check the number of bytes remaining, use (G.csize + G.incnt).  I believe the only places this change was needed were in explode.c,  mostly in the check at the end of each explode function that tests  whether the correct number of bytes has been read.  G.incnt will  normally be zero at that time anyway.  The other place is the line  that says "bd = G.csize > 200000L ? 8 : 7;" but that's just a rough  heuristic anyway.[Paul Kienitz]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -