11cb0ef41Sopenharmony_ciFrom 75690b2683667be5535ac6243438115dc9c40f6a Mon Sep 17 00:00:00 2001
21cb0ef41Sopenharmony_ciFrom: Florian Mayer <fmayer@google.com>
31cb0ef41Sopenharmony_ciDate: Wed, 16 Mar 2022 16:38:36 -0700
41cb0ef41Sopenharmony_ciSubject: [PATCH] Fix out of bounds in infcover.c.
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci---
71cb0ef41Sopenharmony_ci test/infcover.c | 4 +++-
81cb0ef41Sopenharmony_ci 1 file changed, 3 insertions(+), 1 deletion(-)
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cidiff --git a/test/infcover.c b/test/infcover.c
111cb0ef41Sopenharmony_ciindex 2be01646c..a6d83693c 100644
121cb0ef41Sopenharmony_ci--- a/test/infcover.c
131cb0ef41Sopenharmony_ci+++ b/test/infcover.c
141cb0ef41Sopenharmony_ci@@ -373,7 +373,9 @@ local void cover_support(void)
151cb0ef41Sopenharmony_ci     mem_setup(&strm);
161cb0ef41Sopenharmony_ci     strm.avail_in = 0;
171cb0ef41Sopenharmony_ci     strm.next_in = Z_NULL;
181cb0ef41Sopenharmony_ci-    ret = inflateInit_(&strm, ZLIB_VERSION - 1, (int)sizeof(z_stream));
191cb0ef41Sopenharmony_ci+    char versioncpy[] = ZLIB_VERSION;
201cb0ef41Sopenharmony_ci+    versioncpy[0] -= 1;
211cb0ef41Sopenharmony_ci+    ret = inflateInit_(&strm, versioncpy, (int)sizeof(z_stream));
221cb0ef41Sopenharmony_ci                                                 assert(ret == Z_VERSION_ERROR);
231cb0ef41Sopenharmony_ci     mem_done(&strm, "wrong version");
241cb0ef41Sopenharmony_ci 
25