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

Large file support on 32bit platforms #1636

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tcoserea-msft
Copy link

  • on 32bit platforms size_t is not enough to support files with size
    greater than 4GB.

 - on 32bit platforms size_t is not enough to support files with size
greater than 4GB.
@ghost
Copy link

ghost commented Jul 21, 2021

CLA assistant check
All CLA requirements met.

@barcharcraz
Copy link
Member

I don't have a lot of time to review this for correctness on all our platforms and so would like tests, in particular for every data value widened from size_t to int64_t I'd like to see a test that results in that data value actually exceeding UINT32_MAX. I already spotted several instances where you're using int64_t as an offset into an array, or passing it to memcpy.

I'd suggest using truncate(on linux) or SetEndOfFile (on windows) to create a very large file, and then write some known data to a few pages in the very large region.

@@ -468,7 +468,7 @@ size_t _getn_fsb(Concurrency::streams::details::_file_info* info,
if (static_cast<int>(read) > 0)
{
auto copy = (std::min)(read, byteCount);
auto bufoff = fInfo->m_rdpos - fInfo->m_bufoff;
auto bufoff = static_cast<size_t>(fInfo->m_rdpos - fInfo->m_bufoff);
Copy link
Member

Choose a reason for hiding this comment

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

this is concerning to me since it seems like it could cause truncation on a size passed to memcpy, and may need a validation check.

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.

2 participants