Skip to content

<streambuf>: basic_streambuf doesn't support 64-bit properly #388

@wohlstad

Description

@wohlstad

std::basic_streambuf doesn't support 64-bit properly, because it holds the counters in 32-bit ints:

STL/stl/inc/streambuf

Lines 392 to 395 in b614834

int _Gcount; // length of read buffer
int _Pcount; // length of write buffer
int* _IGcount; // pointer to length of read buffer
int* _IPcount; // pointer to length of write buffer

Then e.g. in std::basic_streambuf::setg(...) you have:

*_IGcount = static_cast<int>(_Last - _Next);

and forcing a cast to int prevents from using with a memory range bigger than ~2GB (even on Win64 builds).

Also tracked by DevCom-102668, DevCom-290124, DevCom-320893, DevCom-859581, and Microsoft-internal VSO-485517 / AB#485517.

vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvNextBreaks binary compatibility

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions