diff options
author | Simon Giesecke <sgiesecke@mozilla.com> | 2021-01-07 09:21:48 (GMT) |
---|---|---|
committer | Simon Giesecke <sgiesecke@mozilla.com> | 2021-01-07 09:21:48 (GMT) |
commit | 06b07e175e397bca54c808780251fe0d7a56deae (patch) | |
tree | d288ef539b42ef82442a21f7cef07c90d02ad522 /lib | |
parent | 023bb62c8d353704b0ce44d024900c66307d5e76 (diff) | |
download | lz4-06b07e175e397bca54c808780251fe0d7a56deae.zip lz4-06b07e175e397bca54c808780251fe0d7a56deae.tar.gz lz4-06b07e175e397bca54c808780251fe0d7a56deae.tar.bz2 |
Don't trigger UBSan warning in LZ4_resetStreamHC_fast if LZ4_streamHCPtr->internal_donotuse.end is NULL.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lz4hc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index feee612..e2e4f00 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -1031,7 +1031,11 @@ void LZ4_resetStreamHC_fast (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLev LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr)); } else { /* preserve end - base : can trigger clearTable's threshold */ - LZ4_streamHCPtr->internal_donotuse.end -= (uptrval)LZ4_streamHCPtr->internal_donotuse.base; + if (LZ4_streamHCPtr->internal_donotuse.end != NULL) { + LZ4_streamHCPtr->internal_donotuse.end -= (uptrval)LZ4_streamHCPtr->internal_donotuse.base; + } else { + assert(LZ4_streamHCPtr->internal_donotuse.base == NULL); + } LZ4_streamHCPtr->internal_donotuse.base = NULL; LZ4_streamHCPtr->internal_donotuse.dictCtx = NULL; } |