From 8ad4bc425c633bfdc0faf229f4145a7d17f123a1 Mon Sep 17 00:00:00 2001 From: "Pierre R. Mai" Date: Sun, 21 May 2023 15:14:38 +0200 Subject: [PATCH] Error out on undefined distance codes 30/31 This regularizes our behavior vis-a-vis our handling of undefined length codes. --- deflate.lisp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deflate.lisp b/deflate.lisp index 331f507..e4df392 100644 --- a/deflate.lisp +++ b/deflate.lisp @@ -522,6 +522,10 @@ the corresponding decode-trees for literals/length and distance codes." "Decode the given distance symbol into a proper distance specification." (cond ((<= symbol 3) (1+ symbol)) + ((<= 30 symbol 31) + (error 'deflate-decompression-error + :format-control "Strange Distance Code in bitstream: ~D" + :format-arguments (list symbol))) (t (multiple-value-bind (order offset) (truncate symbol 2) (declare (type (unsigned-byte 4) order offset))