Skip to content

Commit 3297953

Browse files
KungFuJesusDead2
authored andcommitted
Compute the "safe" distance properly
The safe pointer that is computed is an exclusive, not inclusive bounds. While we were probably rarely ever bit this, if ever, it still makes sense to apply the limit, properly.
1 parent 8d10c30 commit 3297953

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

inffast_tpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void Z_INTERNAL INFLATE_FAST(PREFIX3(stream) *strm, uint32_t start) {
260260
if (dist >= len || dist >= state->chunksize)
261261
out = chunkcopy_safe(out, out - dist, len, safe);
262262
else
263-
out = CHUNKMEMSET_SAFE(out, dist, len, (unsigned)((safe - out) + 1));
263+
out = CHUNKMEMSET_SAFE(out, dist, len, (unsigned)((safe - out)));
264264
} else {
265265
/* Whole reference is in range of current output. No range checks are
266266
necessary because we start with room for at least 258 bytes of output,

0 commit comments

Comments
 (0)