Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fix to inflate: treat EOF as a character, as in the C code.

closes PR 13489.

In the C code, inflate is allowed to peek at least one character
beyond the extent of a deflated byte sequence.  The thread related to
the bug report of PR 13489 documents that deflate can peek beyond EOF.
  • Loading branch information...
commit c6775cc0605dfed29e347f1932adcc11b5e220db 1 parent 31b6648
@dyoo authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  collects/file/gunzip.rkt
3  collects/file/gunzip.rkt
@@ -278,7 +278,8 @@
(set! buf-pos MAX-LOOKAHEAD))
(let ([got (peek-bytes-avail! buffer buf-pos #f input-port buf-pos BUFFER-SIZE)])
(if (eof-object? got)
- (error 'inflate "unexpected end of file")
+ (begin (bytes-set! buffer buf-pos 255)
+ (set! buf-max (add1 buf-pos)))
(set! buf-max (+ buf-pos got))))
(let ([v (bytes-ref buffer buf-pos)])
Please sign in to comment.
Something went wrong with that request. Please try again.