diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-07-19 19:48:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-07-19 19:48:53 +0200 |
commit | dd0d5f539a83a0d59eefbccc3d1674183152dd23 (patch) | |
tree | db1755bdd30661ceda0957eb261732daf6010cbd | |
parent | f07a6606e44d7bba88efa55615075a917704bde1 (diff) |
Reorder lz4 code to avoid UBSAN "applying non-zero offset to null pointer"
-rw-r--r-- | libbutl/lz4frame.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libbutl/lz4frame.c b/libbutl/lz4frame.c index ec02c92..0db8c1e 100644 --- a/libbutl/lz4frame.c +++ b/libbutl/lz4frame.c @@ -904,8 +904,8 @@ size_t LZ4F_compressUpdate(LZ4F_cctx* cctxPtr, } /* keep tmpIn within limits */ - if ((cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize) /* necessarily LZ4F_blockLinked && lastBlockCompressed==fromTmpBuffer */ - && !(cctxPtr->prefs.autoFlush)) + if (!(cctxPtr->prefs.autoFlush) && + (cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize)) /* necessarily LZ4F_blockLinked && lastBlockCompressed==fromTmpBuffer */ { int const realDictSize = LZ4F_localSaveDict(cctxPtr); cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize; |