fix zip/gzip bug
Closes PR 12605
This commit is contained in:
parent
6d63c1f548
commit
f9247ff3a5
|
@ -469,7 +469,8 @@
|
|||
(longest_match-loop)))
|
||||
(define (*++scan)
|
||||
(set! scanpos (add1 scanpos))
|
||||
(bytes-ref window-vec scanpos))
|
||||
(and (scanpos . < . window_size) ; the original C code can read past the end of the buffer
|
||||
(bytes-ref window-vec scanpos)))
|
||||
(define (*++match)
|
||||
(set! matchpos (add1 matchpos))
|
||||
(bytes-ref window-vec matchpos))
|
||||
|
@ -479,7 +480,7 @@
|
|||
(eq? (*++scan) (*++match)) (eq? (*++scan) (*++match))
|
||||
(eq? (*++scan) (*++match)) (eq? (*++scan) (*++match))
|
||||
(eq? (*++scan) (*++match)) (eq? (*++scan) (*++match))
|
||||
(< scanpos strendpos))
|
||||
(< scanpos strendpos))
|
||||
(match-eight)))
|
||||
|
||||
(define (longest_match-loop)
|
||||
|
|
BIN
collects/tests/file/deflate-me.dat
Normal file
BIN
collects/tests/file/deflate-me.dat
Normal file
Binary file not shown.
|
@ -31,7 +31,15 @@
|
|||
(define (rand-bytes)
|
||||
(list->bytes (for/list ([j (in-range (random 1000))]) (random 256))))
|
||||
(test-big-file)
|
||||
(for ([i (in-range 100)]) (id* (rand-bytes))))
|
||||
(for ([i (in-range 100)]) (id* (rand-bytes)))
|
||||
(regression-test))
|
||||
|
||||
(define (regression-test)
|
||||
;; check for an out-of-range buffer access:
|
||||
(call-with-input-file*
|
||||
(collection-file-path "deflate-me.dat" "tests/file")
|
||||
(lambda (in)
|
||||
(gzip-through-ports in (open-output-bytes) "defalte-me.dat" (current-seconds)))))
|
||||
|
||||
(provide tests)
|
||||
(define (tests) (test do (run-tests)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user