diff options
author | Ori Livneh <ori.livneh@gmail.com> | 2021-08-23 12:40:19 -0400 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2021-12-24 12:52:14 +0100 |
commit | a9f2e153756d9828378200a2f1a05b4e41dec0d2 (patch) | |
tree | 279aa2a5cbdb5c6f324293c530988e9d00f1512c /inffast.c | |
parent | cdc8033a45ff2276676e434a0b22a4230a28071a (diff) |
Fix UB in inffast.c when not using window
When not using window, `window + wsize` applies a zero offset to a null pointer, which is undefined behavior.
Diffstat (limited to 'inffast.c')
-rw-r--r-- | inffast.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -155,7 +155,7 @@ void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) { /* Detect if out and window point to the same memory allocation. In this instance it is necessary to use safe chunk copy functions to prevent overwriting the window. If the window is overwritten then future matches with far distances will fail to copy correctly. */ - extra_safe = (out >= window && out + INFLATE_FAST_MIN_LEFT <= window + wsize); + extra_safe = (wsize != 0 && out >= window && out + INFLATE_FAST_MIN_LEFT <= window + wsize); /* decode literals and length/distances until end-of-block or not enough input data or output space */ |