Handle data descriptor signatures in file/unzip
http://www.pkware.com/documents/casestudies/APPNOTE.TXT specifies that a data descriptor signature may be placed after the compressed data and before the data descriptor. file/unzip now handles this case.
This commit is contained in:
parent
478b01b0e3
commit
467786fc1c
|
@ -211,12 +211,23 @@
|
|||
(msdos-date+time->seconds date time utc?)))
|
||||
(read-entry filename dir? in))
|
||||
|
||||
;; Read until the end of the deflated stream when compressed size unknown
|
||||
(when (bitwise-bit-set? bits 3)
|
||||
(let loop () (unless (eof-object? (read-bytes 1024 in)) (loop))))
|
||||
|
||||
(when t (kill-thread t)))
|
||||
|
||||
(lambda ()
|
||||
;; appnote VI-C : if bit 3 is set, then the file data
|
||||
;; is immediately followed by a data descriptor
|
||||
;; appnote 4.3.9.3 : the value 0x08074b50 may appear
|
||||
;; as a data descriptor signature immediately
|
||||
;; following the file data
|
||||
(if (bitwise-bit-set? bits 3)
|
||||
(skip-bytes 12 in)
|
||||
;; Read possibly signed data descriptor
|
||||
(let ([maybe-signature (read-int 4)])
|
||||
(skip-bytes (if (= maybe-signature #x08074b50) 12 8)
|
||||
in))
|
||||
(skip-bytes (- (+ mark compressed) (file-position in)) in)))))
|
||||
(void))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user