Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined behavior in ZSTD_decompressStream() #3236

Closed
embg opened this issue Aug 7, 2022 · 1 comment
Closed

Undefined behavior in ZSTD_decompressStream() #3236

embg opened this issue Aug 7, 2022 · 1 comment
Assignees

Comments

@embg
Copy link
Contributor

embg commented Aug 7, 2022

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.

@embg embg self-assigned this Aug 7, 2022
@embg
Copy link
Contributor Author

embg commented Sep 11, 2022

Closed by #3258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant