nixpkgs/pkgs/development/libraries/zlib/CVE-2018-25032-2.patch

27 lines
800 B
Diff

From 4346a16853e19b45787ce933666026903fb8f3f8 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Tue, 17 Apr 2018 22:44:41 -0700
Subject: [PATCH 2/2] Assure that the number of bits for deflatePrime() is
valid.
---
deflate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/deflate.c b/deflate.c
index 19cba87..23aef18 100644
--- a/deflate.c
+++ b/deflate.c
@@ -589,7 +589,8 @@ int ZEXPORT deflatePrime (strm, bits, value)
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
s = strm->state;
- if (s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
+ if (bits < 0 || bits > 16 ||
+ s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
do {
put = Buf_size - s->bi_valid;
--
2.33.1