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

Add tests for DepotChunk, validate PK zip magic #1505

Merged
merged 2 commits into from
Feb 7, 2025
Merged

Add tests for DepotChunk, validate PK zip magic #1505

merged 2 commits into from
Feb 7, 2025

Conversation

xPaw
Copy link
Member

@xPaw xPaw commented Feb 6, 2025

  • Add tests for depot chunks
  • Validate PKzip header, throw for unknown compressions

{
writtenDecompressed = VZipUtil.Decompress( buffer.AsSpan( 0, written ), destination, verifyChecksum: false );
}
else if ( buffer[ 0 ] == 'P' && buffer[ 1 ] == 'K' && buffer[ 2 ] == 0x03 && buffer[ 3 ] == 0x04 ) // PKzip
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steam client code performs the same check.


if ( buffer.Length > 1 && buffer[ 0 ] == 'V' && buffer[ 1 ] == 'Z' )
if ( buffer.Length < 16 )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steam client checks for like 20 bytes for pkzip, and 22 bytes for vzip, I'm just being safe and checking for a smaller value.

@xPaw xPaw requested a review from yaakov-h February 6, 2025 10:52
@xPaw xPaw merged commit 293a0ce into master Feb 7, 2025
17 checks passed
@xPaw xPaw deleted the vzip-cleanup branch February 7, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant