Skip to content

Undefined behavior in ZSTD_decompressStream() #3236

@embg

Description

@embg

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions