zstd
zstd copied to clipboard
Undefined behavior in ZSTD_decompressStream()
When ZSTD_decompressStream() is called with outBuffer == {NULL, 0, 0}, there is undefined behavior here when 0 is added to the NULL outBuffer pointer. UBSAN reports this as "runtime error: applying zero offset to null pointer". It was discovered by folly's CompressionTest.cpp.
Creating this issue to track the following work:
- Add a test to zstd's CI which exposes the UB.
- Refactor
ZSTD_decompressStream()to avoid the UB.
Note: there is no need to raise an error since the input itself is legal.