diff --git a/racket/collects/file/unzip.rkt b/racket/collects/file/unzip.rkt index 7bca18338e..fa962f3f06 100644 --- a/racket/collects/file/unzip.rkt +++ b/racket/collects/file/unzip.rkt @@ -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))))