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 the wrong type i32 used for offset calculation at download to u64 #186

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

okudajun
Copy link
Contributor

@okudajun okudajun commented Aug 7, 2022

The offset calculation for writing a block to download target file is
in i32 after commit 118e586, which replaced the AWS SDK from rusoto
to AWS's one and also replaced the type of block indext and block size.
This causes an integer overflow when there is a block whoes index is
greater than 4096 or the offset is greater than 2 GiB as the block size
is 512 KiB.

This commit will change the type casting of the offset to type castings
of block indext and block size to prevent integer overflows at offset
calculations for downloads.

Issue: #185

Copy link
Contributor

@bcressey bcressey left a comment

Choose a reason for hiding this comment

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

Thanks!

The offset calculation for writing a block to download target file is
in i32 after commit 118e586, which replaced the AWS SDK from rusoto
to AWS's one and also replaced the type of block indext and block size.
This causes an integer overflow when there is a block whoes index is
greater than 4096 or the offset is greater than 2 GiB as the block size
is 512 KiB.

This commit will change the type casting of the offset to type castings
of block indext and block size to prevent integer overflows at offset
calculations for downloads.
Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

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

Thanks!
🎉

@zmrow zmrow merged commit 502594e into awslabs:develop Aug 8, 2022
@okudajun okudajun deleted the for-issue-185 branch August 8, 2022 21:42
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.

4 participants