aboutsummaryrefslogtreecommitdiff
path: root/inflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2024-08-26 23:51:11 -0700
committerMark Adler <madler@alumni.caltech.edu>2024-09-01 13:17:29 -0700
commitf7d01aae6ec6115184de821b93fa47810abd88f9 (patch)
tree04132b01fdaf4e540e67a1005e2f3d7f2ff79263 /inflate.c
parent2968a496d9e297b75bee0d0887f94005799b2d07 (diff)
downloadzlib-f7d01aae6ec6115184de821b93fa47810abd88f9.tar.gz
zlib-f7d01aae6ec6115184de821b93fa47810abd88f9.tar.bz2
zlib-f7d01aae6ec6115184de821b93fa47810abd88f9.zip
Avoid out-of-bounds pointer arithmetic in inflateCopy().
Though it does not matter for code correctness, clang's UBSan injects code that complains about computing a pointer from an array where the result is out-of-bounds for that array, even though the pointer is never dereferenced. Go figure. This commit avoids that possibility when computing distcode in inflateCopy().
Diffstat (limited to 'inflate.c')
-rw-r--r--inflate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/inflate.c b/inflate.c
index e2fa6bb..4feac09 100644
--- a/inflate.c
+++ b/inflate.c
@@ -923,7 +923,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) {
923 while (state->have < 19) 923 while (state->have < 19)
924 state->lens[order[state->have++]] = 0; 924 state->lens[order[state->have++]] = 0;
925 state->next = state->codes; 925 state->next = state->codes;
926 state->lencode = (const code FAR *)(state->next); 926 state->lencode = state->distcode = (const code FAR *)(state->next);
927 state->lenbits = 7; 927 state->lenbits = 7;
928 ret = inflate_table(CODES, state->lens, 19, &(state->next), 928 ret = inflate_table(CODES, state->lens, 19, &(state->next),
929 &(state->lenbits), state->work); 929 &(state->lenbits), state->work);