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

fix: fixed potential overflow when compressing integer #2631

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

sssooonnnggg
Copy link
Contributor

@sssooonnnggg sssooonnnggg commented Aug 29, 2023

Description of Change(s)

When compressing integer, capacity passed to LZ4 is incorrect, because we already passed compressed + 1 as output ptr, the capacity parameter should be LZ4_compressBound instead of LZ4_compressBound + 1.

image

FYI, the caller in crateFile.cpp only allocate a buffer with compressBound + 1 size :

image

Then inside the callee, we passed LZ4 an incorrect capacity larger than actual, which causes undefined behaviour when serializing usdc files

Fixes Issue(s)

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@sssooonnnggg sssooonnnggg changed the title fix: fixed potential overflow when compressing interger fix: fixed potential overflow when compressing integer Aug 29, 2023
@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-8634

@gitamohr
Copy link
Contributor

Nice catch, thanks!

@sssooonnnggg
Copy link
Contributor Author

@gitamohr Hi, can this PR be merged? We are currently using a custom repo with the fix, and cannot use the upstream code.😄

@spiffmon
Copy link
Member

spiffmon commented Mar 13, 2024 via email

@pixar-oss pixar-oss merged commit 85513b0 into PixarAnimationStudios:dev Mar 14, 2024
34 of 36 checks passed
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

Successfully merging this pull request may close these issues.

5 participants